• Advertisement


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

Coding problem with bip animation

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

Is this function, i''m trying to calculate the transformation matrix from local to world (m_matTransformationLocalToWorld) and the transformation matrix from world to local (m_matTransformationWorldToLocal). It sorta works, but the result i have is the character is displayed funny (walking jiggly), i can see the head (attached only to the root bone) is more or less correct, but the hand and feet (probably had to 3 or 4 chain of parent bones) is off by a lot. is it because of the floating point calculation error or am i not doing something right in the following calculation. thanks 13thAngel void Bone::SetTransformation(D3DXVECTOR3 vec3Origin, D3DXVECTOR3 vec3Rotation) { m_v3Origin = vec3Origin; m_v3Rotation = vec3Rotation; D3DXMATRIX matRotateX; D3DXMATRIX matRotateY; D3DXMATRIX matRotateZ; D3DXMatrixRotationX(&matRotateX, vec3Rotation.x); D3DXMatrixRotationY(&matRotateY, vec3Rotation.y); D3DXMatrixRotationZ(&matRotateZ, vec3Rotation.z); D3DXMatrixIdentity(&m_matTransformationWorldToLocal); D3DXMatrixIdentity(&m_matTransformationLocalToWorld); D3DXMatrixMultiply(&m_matTransformationLocalToWorld, &m_matTransformationLocalToWorld, &matRotateX); D3DXMatrixMultiply(&m_matTransformationLocalToWorld, &m_matTransformationLocalToWorld, &matRotateY); D3DXMatrixMultiply(&m_matTransformationLocalToWorld, &m_matTransformationLocalToWorld, &matRotateZ); D3DXMATRIX matTranslate; D3DXMatrixTransformation(&matTranslate, 0, 0, 0, 0, 0, &m_v3Origin); D3DXMatrixMultiply(&m_matTransformationLocalToWorld, &m_matTransformationLocalToWorld, &matTranslate); if(m_pParentBone) D3DXMatrixMultiply(&m_matTransformationLocalToWorld, &m_matTransformationLocalToWorld, &m_pParentBone->m_matTransformationLocalToWorld); // The matrix for getting from local to world is the inverse D3DXMatrixInverse(&m_matTransformationWorldToLocal, 0, &m_matTransformationLocalToWorld); }

Share this post

Link to post
Share on other sites

  • Advertisement