Commit a63cbdc1 authored by D-AIRY's avatar D-AIRY

Ragdolls *undone*

parent 4430e481
......@@ -1189,12 +1189,18 @@ void Animation::setRagdoll(IAnimRagdoll * pRagdoll)
m_pRagdoll = pRagdoll;
if(m_pRagdoll)
{
ModelBone * mBonesOrig = m_pMdl->m_pBonesBindPoseInv;
StopAll();
for(UINT i = 0; i < m_iBoneCount; ++i)
{
if((m_pIsBoneWorld[0][i] = pRagdoll->isBoneAffected(i)))
if(/*i == 18 && */(m_pIsBoneWorld[0][i] = pRagdoll->isBoneAffected(i)))
{
m_CurrentBones[1][i].orient = m_CurrentBones[0][i].orient * pRagdoll->getBoneRotation(i).Conjugate();
//m_CurrentBones[1][i].orient = m_CurrentBones[0][i].orient * pRagdoll->getBoneRotation(i).Conjugate();
//m_CurrentBones[1][i].orient = m_FinalBones[i].orient * pRagdoll->getBoneRotation(i).Conjugate();
//m_CurrentBones[0][i].orient = m_pBoneMatrix[i].orient * mBonesOrig[i].orient.Conjugate();
m_CurrentBones[1][i].position = (float3)((m_pBoneMatrix[i].position - mBonesOrig[i].position) * m_fScale - pRagdoll->getBoneOffset(i));
m_CurrentBones[1][i].orient = m_pBoneMatrix[i].orient * mBonesOrig[i].orient.Conjugate() * pRagdoll->getBoneRotation(i).Conjugate();
//break;
}
}
......@@ -1504,8 +1510,11 @@ void Animation::FillBoneMatrix()
}*/
m_FinalBones[i].position = (float3)(m_FinalBones[i].position + (m_CurrentBones[slot][i].position - mBonesBind[m_FinalBones[i].id].bone.position));
m_FinalBones[i].orient = m_FinalBones[i].orient * (m_CurrentBones[slot][i].orient * mBonesBind[m_FinalBones[i].id].bone.orient.Conjugate());
if(slot == 0 || !m_pIsBoneWorld[0][i])
{
m_FinalBones[i].position = (float3)(m_FinalBones[i].position + (m_CurrentBones[slot][i].position - mBonesBind[m_FinalBones[i].id].bone.position));
m_FinalBones[i].orient = m_FinalBones[i].orient * (m_CurrentBones[slot][i].orient * mBonesBind[m_FinalBones[i].id].bone.orient.Conjugate());
}
}
}
for(UINT i = 0; i < m_iBoneCount; i++)
......@@ -2234,8 +2243,8 @@ void Animation::SwapBoneBuffs()
{
if(m_pIsBoneWorld[0][i])
{
m_CurrentBones[0][i].position = (float3)(m_pRagdoll->getBoneOffset(i) / m_fScale);
m_CurrentBones[0][i].orient = m_pRagdoll->getBoneRotation(i);
m_CurrentBones[0][i].position = (float3)((m_CurrentBones[1][i].position + m_pRagdoll->getBoneOffset(i)) / m_fScale);
m_CurrentBones[0][i].orient = m_CurrentBones[1][i].orient * m_pRagdoll->getBoneRotation(i);
}
}
}
......
......@@ -154,7 +154,9 @@ CRagdoll::CRagdoll(IAnimPlayer *pAnimPlayer)
//m_bodies[i]->setAngularFactor(0.0f);
//m_bodies[i]->setLinearFactor(btVector3(0.0f, 0.0f, 0.0f));
}
//m_bodies[1]->setAngularFactor(0.0f);
//m_bodies[1]->setLinearFactor(btVector3(0.0f, 0.0f, 0.0f));
//UINT bone = pAnimPlayer->GetBone("bip01_head");
{
btTransform localA, localB;
btConeTwistConstraint * pCTC;
......@@ -451,7 +453,9 @@ SMQuaternion CRagdoll::getBoneRotation(ID id)
{
assert(ID_VALID(m_pidBones[id]));
//return(SMQuaternion());
return(BTQUAT_Q4(m_bodies[m_pidBones[id]]->getWorldTransform().getRotation())/* * SMQuaternion(-SM_PIDIV2, 'x') * SMQuaternion(-SM_PIDIV2, 'z')*/);
return(BTQUAT_Q4(m_bodies[m_pidBones[id]]->getWorldTransform().getRotation()) );
// * SMQuaternion(SM_PIDIV2, 'y') * SMQuaternion(-SM_PI, 'z')
// * SMQuaternion(-SM_PIDIV2, 'x') * SMQuaternion(-SM_PIDIV2, 'z')
}
btRigidBody *CRagdoll::localCreateRigidBody(btScalar mass, const btTransform& startTransform, btCollisionShape* shape)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment