Backov
31-05-2007 20:12:19
I've got a racer object, and that racer has a maximum thrust, in newtons or whatever (haven't quite got there yet).
Now, in my frame updates, what's the proper way to apply that force? Do I apply the proper amount of force every frame? Any ideas?
this code applies four times the gravity force in a body:
//----------------------------------------------------------------------
/*!
Apply an amount to the standard gravity in the mass center
*/
void NxFourWheels::_increaseGravity( Ogre::Real elapsedTime )
{
static const Vector3 FORCE = -4.0*9.807*mMass*Vector3::UNIT_Y;
mBody->addForceAtLocalPos( elapsedTime*FORCE,
mMassCenter );
}
You could something like this. It is better if you do it in a fixed timing.
Backov
31-05-2007 20:26:27
Right, so you're giving it that force per second then. Fair enough, I'll give that a try.