Jump to content
  • Advertisement
Sign in to follow this  
wlb2001

Skeletal Animation and Quaternion

This topic is 4478 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 Guys: I got a problem of Quaternion when I am implementing Skeletal Animation. To be brief, Say the first animation is a rotation which is: q1{0.707107f, 0.707107f, 0.000000f, 0.000000f}; And second animation is a rotation which is : q2{0.000000f, -0.707107f, -0.707107f, 0.000000f}; There is one thing that I have to mention is, this animation only 2 keyframe that I made by maya,that is: 1. rotate along x-axis 90 degree. 2. rotate along y-axis 90 degree. Now after I export it then get above 2 quaternions. for the q1, it is easy to understand that it is cos(90/2), sin(90/2) * v(1,0,0) which is rotate along x- axis 90 degree. But for q2, it is cos(90/2),sin(90/2) * v(1,1,0).well, that means q2 includes the q1 information as well. becuase originally for the second animation, i only rotated against y-axis 90 degree, not along xy-axis. Now the first question is, does q2 mean glRotatef(90,1,0,0); glRotatef(90,0,1,0); or glRotatef(90,1,1,0); or glRotatef(90,0,0,1); (I have translate q2 to matrix, which is same as glRotatef(90,0,0,1), but isn't cos(90/2),sin(90/2) * v(1,1,0) mean glRotatef(90,1,1,0)? ) The second question is, how can i apply slerp from q1 to q2? my solution is diferrence(q2, q1, result); // calculate inverse q1 //corssproduct inversw q1 and q2 Slerp(q1, result, t, final); QtoMatrix(final, m); glPushMatrix(); glMultMatrixf(m); Draw(); glPopMatrix(); t = t + 0.001f; Problems are 1: the result quaternion is not the quaternion that i expected, ((0.707107f,0,0.707107f,0) which represent rotate along y-axis 90 degrees) it is (0.5,0.5,0.5,0.5). 2: when slerping, the start point and final point are correct shows on the screen but the path is not correct. It shows a very strange path. So, could anyone tell me what's wrong with it? Thanks for ur help

Share this post


Link to post
Share on other sites
Advertisement
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!