void BulletDynamicsBody::GetTransform( Vector3& position, Quaternion& rotation ) { // get updated parameters const btTransform& transform( GetBody()->getWorldTransform() ); const btVector3& origin( transform.getOrigin() ); const btQuaternion currentRotation( transform.getRotation() ); const btVector3& axis( currentRotation.getAxis() ); const btScalar& angle( currentRotation.getAngle() ); position = Vector3( origin.x(), origin.y(), origin.z() ); rotation = Quaternion( float(angle), Vector3( axis.x(), axis.y(), axis.z() ) ); }
void DynamicsMotionState::setWorldTransform(const btTransform& transform) { // DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); // get updated parameters const btVector3& origin( transform.getOrigin() ); const btQuaternion rotation( transform.getRotation() ); const btVector3& axis( rotation.getAxis() ); const btScalar& angle( rotation.getAngle() ); Vector3 newPosition( origin.x(), origin.y(), origin.z() ); const Vector3 newAxis( axis.x(), axis.y(), axis.z() ); Quaternion newRotation( float(angle), newAxis ); // set the nodes updated params mDynamicsBody.SetNodePositionAndRotation( newPosition, newRotation ); }
void MatrixStack::rotate(btQuaternion rot) { btVector3 *axis = &rot.getAxis(); Matrix4 rot_matrix; rot_matrix.rotate(RADTODEG(rot.getAngle()), axis->x(), axis->y(), axis->z()); m_currentMatrix = m_currentMatrix * rot_matrix; }