Sign in to follow this  
sepul

Skeletal Animation : Rotation !

Recommended Posts

sepul    257
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
sepul    257
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;
61;
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this