Boney Reanimated

posted in mittentacular
Published December 09, 2007
Advertisement
He lives again. As it turns out, the big, complicated function isn't necessarily the source of the bug.



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 );	}}
Previous Entry Of DirectX and D3DX
Next Entry Fire Walk With Me
0 likes 2 comments

Comments

Evil Steve
Ooh, I only just noticed you're doing MD5 mesh stuff. I tinkered with it a couple of months back, but gave up when I found out how much of a PITA it was to get the animation going in a shader...
December 10, 2007 03:39 AM
mittens
Yeah. That was actually one of my future goals with the whole thing. Glad to know I can expect a headache for it.
December 10, 2007 09:19 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement