How do I use the world matrix to rotate objects...? Or am I looking at the wrong thing? If so, what should I use to create the objects?
Printable View
How do I use the world matrix to rotate objects...? Or am I looking at the wrong thing? If so, what should I use to create the objects?
Multiply tranlation, scaling, and rotation matrices, to get them to rotate, as well as move or scale.
Z.
But HOW do I get these matrices from the Vertices?
a Vertex maxtrix is simply (x,y,z) you multiply it by a rotation maxtrix (don't ask me the values, once upon a time i knew but not now) and the answer is a new (x,y,z)
isn't there something built into direct x to do this for you? Multiplying maxtrixs in code gives me a headache, i made my library to handle it ages ago and haven't touched it since
Actually, you cant do <x, y, z> * 4x4 matrix(A 3D transformation). Vertices have to be in the form <x, y, z, w>. The w value is a scaler value, and is usually 1. If you are using DirectX, the World Matrix will be applied to any vertices passing through the transformation pipeline. So, if you wanted to rotate a model,you would set the world matrix to a rotation matrix you had created, then draw the model. If you then wanted to draw another model at a different rotation, just change the world matrix, and draw the second model and both models will draw correctly.
Z.
That makes sense, just like changing textures and materials and such... Thanks both of you.