runevision
03-05-2006 10:04:35
Hi
I've read several times that setting the velocity of an object (or its omega) is not recommended, since then the physics calculations won't work as expected (as far as I have understood). Everything should be done using forces. But how, exactly?
As far as I know, forces have no immediate effect, but always has an effect over a given duration of time. So when needing to change the velocity of an object, doesn't one have to consider over how long time this change in velocity should occur? Over 1 second? or over a tenth of a second?
How does one calculate which force is needed to obtain a given velocity over a given duration of time?
I also guess that if the time duration is shorter than one frame in the physics simulation, problems will occur, since the object will gain a greater velocity than desired?
Or have I misunderstood everything?
According to my understanding, the following advise on how to make an object stop, which I read in a different thread, will not necessarily work:
This does not take into account mass OR duration, so will it really work? If not, what is the correct way of making an object stop using a force?
To sum it up, I need the advise 'to do everything with forces' extended a little with some guidelines on how to do it.
Thanks in advance,
Rune
I've read several times that setting the velocity of an object (or its omega) is not recommended, since then the physics calculations won't work as expected (as far as I have understood). Everything should be done using forces. But how, exactly?
As far as I know, forces have no immediate effect, but always has an effect over a given duration of time. So when needing to change the velocity of an object, doesn't one have to consider over how long time this change in velocity should occur? Over 1 second? or over a tenth of a second?
How does one calculate which force is needed to obtain a given velocity over a given duration of time?
I also guess that if the time duration is shorter than one frame in the physics simulation, problems will occur, since the object will gain a greater velocity than desired?
Or have I misunderstood everything?
According to my understanding, the following advise on how to make an object stop, which I read in a different thread, will not necessarily work:
// Get current velocity
Ogre::Vector3 oppositeForce = body->getVeolcity();
// Reverse it
oppositeForce = Ogre::Vector3::ZERO - oppositeForce;
// Apply it
body->addForce(oppositeForce);
This does not take into account mass OR duration, so will it really work? If not, what is the correct way of making an object stop using a force?
To sum it up, I need the advise 'to do everything with forces' extended a little with some guidelines on how to do it.
Thanks in advance,
Rune