Jump to content
  • Advertisement
Sign in to follow this  

Mesh Animation

This topic is 3831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Using vb.net 2003 with Dx 9.0c I have a male mesh that I made. I'm trying to move the meshes leg as though it was walking. I can use: Leg.Matrix = Matrix.RotationX(DXUtil.DegreeToRadian(60) * CSng(Math.Cos((CDbl(Tick) / 500.0F)))) To move the leg back and forth as though it was walking but the leg moves to the center of the mesh. If I use: Leg.Matrix = Matrix.Multiply(Leg.Matrix,Matrix.RotationX(DXUtil.DegreeToRadian(60) * CSng(Math.Cos((CDbl(Tick) / 500.0F)))) The leg stays where it is supposed to but swings all the way around,not back and forth. Anybody know how I can solve this problem. Thanks Steve

Share this post

Link to post
Share on other sites
In the first instance, you don't have an offset (translation) for the leg matrix. I suspect Leg.Matrix was originally set up with a translation to its proper position. Then "Leg.Matrix = Matrix.RotationX()" overwrites it and the translation is gone.

In the second instance, you continually add a rotation to the existing matrix.
That is:

Leg.Matrix = Leg.Matrix * Matrix.Rotation;

Next time through the loop, you add a rotation to the previous rotation.

You probably want something like:

// when the leg is initialized
originalMatrix = Leg.Matrix; // save a copy of the original matrix

and then

// in your loop or OnUpdate or whereever you get Tick
Leg.Matrix = Matrix.Multiply(Matrix.RotationX(...),originalMatrix);

In the Matrix.Multiply() call, I'm pretty sure you will want to rotate the leg, then translate it. If it rotates about the wrong point, go back to


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!