Advertisement
Guest User

Motion State Source

a guest
Mar 30th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. MotionState::MotionState(Transform* visualTransform, const btTransform& bulletTransform)
  2.     : mVisualTransform(visualTransform)
  3.     , mTransform(bulletTransform)
  4. {}
  5.  
  6. void MotionState::getWorldTransform(btTransform &worldTrans) const
  7. {
  8.     worldTrans = mTransform;
  9. }
  10.  
  11. void MotionState::setWorldTransform(const btTransform &worldTrans)
  12. {
  13.     if(!mVisualTransform)
  14.         return;
  15.  
  16.     mTransform = worldTrans;
  17.  
  18.     btQuaternion rot = mTransform.getRotation();
  19.     btVector3 pos = mTransform.getOrigin();
  20.     mVisualTransform->setOrientation(Quaternion(rot.w(), rot.x(), rot.y(), rot.z()));
  21.     mVisualTransform->setPosition(Vector3(pos.x(), pos.y(), pos.z()));
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement