Tuesday, February 26, 2008

Matrices and Transforms

Over the course of the summer I have been experimenting with 3D model transforms (moving a model in 3D space). It has really been interesting, as the concept is so simple!

You can describe a model's location in space by using a series of matrices. You can have a matrix for rotation, position, scale. You can then simply multiply these all together with an identity matrix and presto!, you have the model transformation!

So all you need to do is create a series of properties in your model class which return a matrix for each of the above, then when the model render phase is called, you can multiply the returned property values together to set the transform for the model.

The best thing about this method is you can use it to control the camera movement as well.