Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 15th, 2013  |  syntax: C++  |  size: 1.19 KB  |  views: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data