Jump to content
  • Advertisement
Sign in to follow this  
Samurai Jack

Computed rotation matrix to quaternion?

This topic is 3427 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

Hello! I've got a problem, and don't even know whenever this is possible to solve in that way. The best way to explain is to demonstrate what I do:
LocalBoneMatrix = Matrix.Identity;
LocalBoneMatrix = Matrix.CreateRotationX(x) * Matrix.CreateRotationY(y) * Matrix.CreateRotationX(z);
LocalBoneMatrix.Translation = new Vector3(x,y,z); //sets M._41, _42, _43
Okay, so far it is clear and simple. But the problem appears whenever I try to create a quaternion and translation like this:
Quaternion rotation = Quaternion.FromMatrix(LocalBOneMatrix);
Vector3 position = LocalBoneMatrix.Translation;
Matrix comp = new Matrix.FromQuaterion(rotation);
comp.Translation = position;
The wierd stuff is that the comp matrix is not the same as LocalBoneMatrix and the animaton gets messed up. Is it possible to store 3 different rotation into one quaternion and restore it?!

Share this post

Link to post
Share on other sites
Looks to me like you are setting the matrix to a translation after you apply rotation, instead of multiplying rotation by translation and then setting.

But I use Dx10 and I have no idea what you are using with matrix properties. I guess its XNA. So, I can't follow what's going on.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!