[Solved] Changing velocity using forces?

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:
// 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

runevision

13-05-2006 17:49:26

Okay, it's been ten days now, and even though I've learned a lot about OgreNewt in the mean time, this issue seems still just as relevant - and unanswered - as before.

So again: How does one make an object gain a certain velocity using forces? Or make an object stop using forces?

I hope someone can come with some advise on this, as it seems to be obviously a very basic concept when working with Newton.

Rune

walaber

15-05-2006 18:01:14

this is just a physics math problem.

if you want to "stop" a body in 1 timestep, do this:

Force = Mass * Acceleration.

we need to calculate the acceleration necessary to stop the body.

Acceleration = change_in_velocity / time

so we do this:

Acceleration = (goal_velocity - current_velocity) / time.

in the case of stopping an object, the "goal_velocity" is just zero, but it could be anything.

so the final formula is something like this:

Force = mass * ( ( goal_vel - current_vel) / timestep );

runevision

17-05-2006 17:26:20

this is just a physics math problem.

if you want to "stop" a body in 1 timestep, do this:
(...)
in the case of stopping an object, the "goal_velocity" is just zero, but it could be anything.

so the final formula is something like this:

Force = mass * ( ( goal_vel - current_vel) / timestep );


Thanks! This is very helpful. :)

Rune