Jump to content
  • Advertisement
Sign in to follow this  

Skeletal Animation : Rotation !

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

I'm having a problem in rotation in keyframes, all keyframes and other stuff are read from x file. the bone structure has two matrices, localMat, and the worldMat, which is calculated recursively by multiplying localMat s. when I export Matrix keyframes, it works fine , the localMat, calculation part looks like this:
	hmrMatrix3 transformMat( nextKey.m - key.m );
	float s = (time - key.t) / (nextKey.t - key.t);
	_bone->_localMat = transformMat * s + key.m;
but when I export quaternions, the animation gets messed up :
	hmrMatrix3 mat;
	float s = (time - key.t) / (nextKey.t - key.t);
	hmrQuaternion q = hmrQuaternion::slerp(key.q, nextKey.q, s); 
	mat.setRotation( q );
	_bone->_localMat *= mat;
I thought the problem is with slerp or setting up matrix rotation calculations, but I tested it with D3DX functions and matrices too, and nothing chenged. am I doing something wrong here ?

Share this post

Link to post
Share on other sites
anyone ?
I've read somewhere that if I use, D3DXMatrixRoatationQuaternion, I must also transpose the matrix, which I did, but I get messed up results as usual.

another thing, when i read X file, the keyframe is formated something like this:

AnimationKey {
0;4;-0.707107,-0.000000,0.707107,0.000000;;, <----------- quaternion

the quaternion key is stored in [time][numValues][w][x][y][z], am I right ?

could someone at least, help me with the transform matrix calculation part, and confirm if it is correct ?

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!