I’m making a simple game in XNA (for Windows, if that makes a difference), and when the player moves right, I’m using the following code to rotate the ship model to make it look like the ship is leaning into the strafe:
RotationMatrix = Matrix.CreateRotationX(MathHelper.PiOver2) *
Matrix.CreateRotationY(0.4f);
That works, but it instantly pops the ship to the desired rotation. I would rather it ease in over a few frames. For reference, the rotation matrix was declared as follows:
public Matrix RotationMatrix = Matrix.CreateRotationX(MathHelper.PiOver2);
What can I do to smooth the lean?
I think that You just need to include time into your code. In Xna, you have access to
GameTimeobject (inGame.Drawmethod, for example ), so, you may try something like this:From place I’m now, I cannot check if this code is valid, so this is only idea ;).