Superfluous‎ > ‎Experimentation‎ > ‎

XNA Matrix Transformations (2d/3d)

Another cool little lab project collaboration with Chris Watkins for a first year games RHUL lab we were running. 

We were teaching the students about the virtues of homogeneous matrices and their respective transformations, starting in 2d with a plane drawn with SpriteBatches.  


The real win is when you get 3D for free! So in 3d mode we use a model of a real plane but use the same matrices to describe the plane (and its props). The props are an other example of how matrix representations are good because they can be described as a relative transformation from the position and orientation of the plane itself:

    // We want the second propeller to be to the left, not the right; to be reflected in the Y axis,
    // and to rotate at the same rate in the opposite direction
    _propellerTransformation2 =
       propellerCenteringTranslation *
Matrix.CreateScale(0.3f, 0.3f, 1.0f) *
Matrix.CreateRotationZ( - _angle ) *
Matrix.CreateTranslation(-120, -3, 0);


ċ
TwitteringMachines_2d3d.zip
(1341k)
Tim S,
14 Jun 2010, 18:14
Comments