Timestep and forces

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Timestep and forces

Postby Slick » Mon Jul 01, 2013 3:55 pm

I haven't upgraded to Newton 3.0 yet but this is more of a general question.

Do I need to utilize the current timestep when adding forces? For example gravity but not limited to gravity. If I add a force I am guessing I can ignore the timestep because the world is updated with reference to a timestep so cumulatively an even force is applied and I can ignore timestep when computing needed forces.
Slick
 
Posts: 330
Joined: Sat Feb 07, 2004 7:24 pm
Location: LA last and France now

Re: Timestep and forces

Postby JoeJ » Mon Jul 01, 2013 4:24 pm

Yes and no. If we talk about gravity, you can ignore timestep.
Gravity is constant and you should get similar results running at 60 or 120 Hz.

But constant forces lead to acceleration, which you don't want usually.
If you want to calculate force to move body to a target position, you need to use timestep.
Also, if you want calc force to get constant velocity, you need timestep too.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Timestep and forces

Postby Slick » Mon Jul 01, 2013 5:36 pm

Thanks for the fast response. I think this helps me.

One thought though if the simulation is updated at a constant timestep which I think is how a lot of people do it do you then still have to use timestep in force calculations?
Slick
 
Posts: 330
Joined: Sat Feb 07, 2004 7:24 pm
Location: LA last and France now

Re: Timestep and forces

Postby JoeJ » Mon Jul 01, 2013 6:37 pm

Slick wrote:if the simulation is updated at a constant timestep which I think is how a lot of people do it do you then still have to use timestep in force calculations?


Better yes, but it depends on use case. I recommend to try the examples i gave. Then you'll get used to it.
1. Make some bodies with different masses move at equal constant speed sideways, while they are still under influence of downwards gravity.
2. Make them follow a mousedriven target as responsive as possible.
... that's some good training and helped me a lot.
You learn something about controlling bodies at will, and you'll face a problem like:
I want to have my body at some position the next frame, and the next frame happens exactly at: now + timestep,
so i need to use the value of timestep somehow.

If you already have force calculations set up and worry there's something wrong,
simply multiply (or divide) your force factors by your current timestep so that nothing changes in simulation, even if you change the timestep.

You can use hand tuned constants and ignore timestep as it is constant, yes.
But you may wanna change simulation rate somewhen in the future, and more important:
You do more trial and error and have less understanding.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron