Advertisement
Guest User

Untitled

a guest
Apr 15th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. //OFFSETS
  2.  //get all offsets first
  3.                 while(currentParentIndex > -1)
  4.                 {
  5.                         vOffsets.push_back(pMeshFilter->GetSkeleton().at(currentParentIndex).Offset);
  6.                         currentParentIndex = pMeshFilter->GetSkeleton().at(currentParentIndex).Parent;
  7.                 }
  8.  
  9.                 //inverse the vector and calculate the total offset
  10.                 std::reverse(vOffsets.begin(), vOffsets.end());
  11.                 for(auto offset : vOffsets)
  12.                 {
  13.                         m_matTotalOffset *= offset;
  14.                 }
  15.                 //finally adding it's own offset to the calculation to get the final position on modelspace
  16.                 m_matTotalOffset *= m_pBone->Offset;
  17.  
  18. //UPDATELEECHMODE
  19. void PhysxBone::UpdateLeechMode(D3DXMATRIX matKeyTransform)
  20. {
  21.         //Calculate the final position
  22.         //Orientation * TotalOffset * LocalTransformAnimation
  23.         m_matWorldSpace = m_matTotalOffset * matKeyTransform * world;
  24.  
  25.         //Convert matrix and position the actor
  26.         NxMat34 nPos;
  27.         PhysicsManager::GetInstance()->DMatToNMat(nPos, m_matWorldSpace);
  28.         m_pActor->setGlobalPose(nPos);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement