Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualDgekGD

Posted 29 November 2012 - 08:18 AM

I'm using bullet physics for my game and this is how I rotate character in the game.

  btMatrix3x3 orn = m_pRigidBody->getWorldTransform().getBasis(); //get basis of world transformation
  orn *= btMatrix3x3(btQuaternion(axis, radians));     //Multiply it by rotation matrix
 m_pRigidBody->getWorldTransform().setBasis(orn); //set new rotation for the object

m_pRigidBody is an object of btRigidBody*. To represent rotation all you need is 3x3 matrix (4th row and column are to enable translation). So you get basis of world transform and then multiply it by rotation matrix( created with the help of quaternion, where the axis is axis of rotation and radians is angle in radians). After that all you have to do is to update basis of your world transform.
For more information about quaternions I would recommend visiting this link.

I hope it helps;)

#1DgekGD

Posted 29 November 2012 - 08:16 AM

I'm using bullet physics for my game and this is how I rotate character in the game.

  btMatrix3x3 orn = m_pRigidBody->getWorldTransform().getBasis(); //get basis of world transformation
  orn *= btMatrix3x3(btQuaternion(axis, radians));     //Multiply it by rotation matrix
 m_pRigidBody->getWorldTransform().setBasis(orn); //set new rotation for the object

m_pRigidBody is an object of btRigidBody*. To represent rotation all you need is 3x3 matrix (4th row and column are to enable translation). So you get basis of world transform and then multiply it by rotation matrix( created with the help of quaternion, where the axis is axis of rotation and radians is angle in radians). After that all you have to do is to update basis of your world transform.
For more information about quaternions I would recommend visiting this link.

PARTNERS