I’ve been following this tutorial[1] on procedural mesh generation. I reached the part about creating a box, but there’s one thing I don’t understand. Namely, this single line of code:
BuildQuad(meshBuilder, nearCorner, upDir, forwardDir);
Why does he use upDir as width and forwardDir as height, instead of the opposite? If you have the middle left side of the box, wouldn’t the forward direction aka z correspond with the width of the face, and the up direction / y correspond with the length?
I have 6 BuildQuad calls of which three are below(the method can be found on the site i linked):
Vector3 upDir = Vector3.up * m_Height;
Vector3 rightDir = Vector3.right * m_Width;
Vector3 forwardDir = Vector3.forward * m_Length;
BuildQuad(meshBuilder, nearCorner, forwardDir, rightDir);
BuildQuad(meshBuilder, nearCorner, rightDir, upDir);
BuildQuad(meshBuilder, nearCorner, upDir, forwardDir);
This is what the first three calls generate(Imgur: The magic of the Internet ) So the first BuildQuad makes the bottom face. The width of that face would be whatever is the rightDir, and the length would be whatever is in the forwardDir, I understand that. For the second, which is the back face, the width would simply be the rightDir and the height the upDir. But for the third face, the left face, why isn’t the width the forwardDir, and the height the upDir? Why is it the other way around? If you look at the picture, the z axis clearly corresponds to the width of that face, and the y axis corresponds with the height.