I have an object which can be rotated by the player. But if the player rotates this object, it is not supposed to slow down an move slowly in the other direction, but it is supposed to use the velocity in the new direction.
So here is some code:
Code: Select all
float velocity = body_->getLinearVelocity().length();
btVector3 new_velocity = BtOgre::Convert::toBullet( this->get_facing_direction() * velocity );
body_->setLinearVelocity( new_velocity );But my object is not allowed to rotate around any axis except on the z-axis. So I used:
Code: Select all
body_->setAngularFactor( btVector3( 0, 0, 1 ) );But I don't understand why.
Is there any other way to realise what I want without using setLinearVelocity? Or do you have an idea why the object is rotating though setAnglarFactor is used?
Thanks for your help.