Original Code:
void CMD5MeshNode::InterpolateSkeletons( int iCurrentFrame, int iNextFrame, float fDelta ){ if( !m_pAnimations || !m_pAnimations[m_ulActiveAnimationID].ppSkeletonFrames || !m_pJoints ) return; for( int iJointIdx = 0; iJointIdx < m_iNumJoints; iJointIdx++ ) { const MD5File_Joint* pJoint_SkelA = &m_pAnimations[m_ulActiveAnimationID].ppSkeletonFrames[iCurrentFrame][iJointIdx]; const MD5File_Joint* pJoint_SkelB = &m_pAnimations[m_ulActiveAnimationID].ppSkeletonFrames[iNextFrame][iJointIdx]; // m_pJoints[iJointIdx].strName = pJoint_SkelA[iJointIdx].strName.c_str( ); m_pJoints[iJointIdx].iParent = pJoint_SkelA[iJointIdx].iParent; m_pJoints[iJointIdx].v3Position = pJoint_SkelA[iJointIdx].v3Position + ( fDelta*( pJoint_SkelB[iJointIdx].v3Position - pJoint_SkelA[iJointIdx].v3Position ) ); m_pJoints[iJointIdx].quatOrientation = pJoint_SkelA[iJointIdx].quatOrientation; D3DXQuaternionSlerp( &m_pJoints[iJointIdx].quatOrientation, &pJoint_SkelA[iJointIdx].quatOrientation, &pJoint_SkelB[iJointIdx].quatOrientation, fDelta ); }}
Fixed:
void CMD5MeshNode::InterpolateSkeletons( int iCurrentFrame, int iNextFrame, float fDelta ){ if( !m_pAnimations || !m_pAnimations[m_ulActiveAnimationID].ppSkeletonFrames || !m_pJoints ) return; const MD5File_Joint* pJoint_SkelA = m_pAnimations[m_ulActiveAnimationID].ppSkeletonFrames[iCurrentFrame]; const MD5File_Joint* pJoint_SkelB = m_pAnimations[m_ulActiveAnimationID].ppSkeletonFrames[iNextFrame]; for( int iJointIdx = 0; iJointIdx < m_iNumJoints; iJointIdx++ ) { m_pJoints[iJointIdx].iParent = pJoint_SkelA[iJointIdx].iParent; m_pJoints[iJointIdx].v3Position = pJoint_SkelA[iJointIdx].v3Position + ( fDelta*( pJoint_SkelB[iJointIdx].v3Position - pJoint_SkelA[iJointIdx].v3Position ) ); m_pJoints[iJointIdx].quatOrientation = pJoint_SkelA[iJointIdx].quatOrientation; D3DXQuaternionSlerp( &m_pJoints[iJointIdx].quatOrientation, &pJoint_SkelA[iJointIdx].quatOrientation, &pJoint_SkelB[iJointIdx].quatOrientation, fDelta ); }}