//OFFSETS //get all offsets first while(currentParentIndex > -1) { vOffsets.push_back(pMeshFilter->GetSkeleton().at(currentParentIndex).Offset); currentParentIndex = pMeshFilter->GetSkeleton().at(currentParentIndex).Parent; } //inverse the vector and calculate the total offset std::reverse(vOffsets.begin(), vOffsets.end()); for(auto offset : vOffsets) { m_matTotalOffset *= offset; } //finally adding it's own offset to the calculation to get the final position on modelspace m_matTotalOffset *= m_pBone->Offset; //UPDATELEECHMODE void PhysxBone::UpdateLeechMode(D3DXMATRIX matKeyTransform) { //Calculate the final position //Orientation * TotalOffset * LocalTransformAnimation m_matWorldSpace = m_matTotalOffset * matKeyTransform * world; //Convert matrix and position the actor NxMat34 nPos; PhysicsManager::GetInstance()->DMatToNMat(nPos, m_matWorldSpace); m_pActor->setGlobalPose(nPos); }