Timestep and velocity

Bekas

08-09-2006 05:19:05

Hi all,

I'm new to OgreNewt; I noticed something that seemed a bit strange so hopefully someone can clarify it for me.

In Demo01_TheBasics, different newton framerate setting (I'm talking about the framerate parameter you pass when you create the Ogrenewt framelistener) affect the physic simulation a great deal.

The object that you "shoot" goes very far when you set the framerate to 60, but greater values give a shorter path for the object. For example, at 600 framerate the object can barely cover a little distance forward before starting to fall straight down and also it seems that it goes down in constant speed instead of accelerating.

I was expecting that the physic simulation would be consistent for newton framerates > 60; why isn't it so?

walaber

08-09-2006 05:37:42

there is a parameter called "linear damping" and "angular damping". this is basically a reduction in the linear and angular velocity by a small amount each frame.

be default for Newton, it is set to 0.1, so you see a 10% loss in velocity each frame. that is why updating less frequently (60hz) the object loses velocity slower.

you can call the setLinearDamping() function to a small value like 0.001 to greatly reduct this effect, but it will always be there.

Bekas

08-09-2006 06:19:29

Thank you for the explanation and for the great library :)