# 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.

## 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 on other sites
Hi this might help you out, this tutorial shows how to import md5 model, there is also source code available.

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633308
• Total Posts
3011293
• ### Who's Online (See full list)

There are no registered users currently online

×