Manipulating the Tanks

Remember earlier when you were looking at the new frame class? Two sets of matrices were being stored, the transformation matrix and the combined matrix. However, they were never actually set to anything, so how are they supposed to work? Well, the transformation matrices are actually set by the runtime, after the model is loaded. It knows, for example, that the tank's gun turret should sit just above the tank's body, and it sets the transformation matrix to make this happen. The combined transformation matrix, however, is something you've added that the runtime knows nothing about. Look at the Update method in Listing 13.8 and add it to your tank class.

Listing 13.8. Updating the Tank
 /// <summary> /// Update the tank ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.