Advertisement Jump to content


This topic is now archived and is closed to further replies.


CS skeleton animation problem.

This topic is 5396 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 have some problem when I process CS anmation data. I get the animation data like this: for(int iBone = 0; iBone < iTotalBones; ++ iBone) { INode* pBoneNode = pBoneList->Get(iBone)->GetMaxNode(); //get the 0-time matrix, and invert it Matrix3 initMat = pBoneNode->GetNodeTM(0); initMat.Invert(); //save it. pBoneList->Get(iBone)->SetInitMat(initMat); } for(int iTime = 0; iTime < iTotalTimes; ++ iTime) { for(iBone = 0; iBone < iTotalBones; ++ iBOne) { //A BoneInfo struct contain the INode ptr and influence vertex count, and child bone list. BoneInfo* pBoneInfo = pBoneList->Get(iBone); //use inverted 0-time matrix to transforming the i-Time matrix to get the final matrix. Matrix3 finalMat = pBoneInfo->GetInitMat() * pBoneInfo->GetMaxNode()->GetNodeTM(iTime); //convert finalMat to D3DXMATRIX Matrix3 rotateMat(TRUE); Point3 offset = finalMat.GetTrans(); Quat rotateQuat(finalMat); rotateQuat.MakeMatrix(rotateMat, FALSE); D3DXMATRIX d3dMat; D3DXMatrixIdentity(&d3dMat); d3dMat._11 = rotateMat.m[0][1]; d3dMat._12 = rotateMat.m[0][2]; d3dMat._13 = rotateMat.m[0][3]; d3dMat._21 = rotateMat.m[1][1]; d3dMat._22 = rotateMat.m[1][2]; d3dMat._33 = rotateMat.m[1][3]; d3dMat._31 = rotateMat.m[2][1]; d3dMat._32 = rotateMat.m[3][2]; d3dMat._33 = rotateMat.m[3][3]; d3dMat._41 = offset.x; d3dMat._42 = offset.y; d3dMat._43 = offset.z; } } //------------------------------------------------------------ And I render my animation like this: if (pAnimation->IsFrameUpdated()) { int iTotalBones = 0; //pMatrices is the matrix array that in now frame used to transforming corresponding vertex D3DXMATRIX* pMatrices = pAnimation->GetCurFrameMatrices(&iTotalBones); //use BLENDWEIGHT,BLENDINDICES and TESSFACTOR source stream to transform each vertex. //TESSFACTOR is the number of bones assigned to each vertex. Because I use VS to render //skeleton animation. } I think that every thing is finined, but the render result is not correct! And I don''t know, what''s error I maked?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!