Slow motion

Hi everyone,

I am learning JMonkey. I really like it so far :wink:

I was wondering though how one could slow down time when using physics. I can’t seem to find this in the tutorials, and I don’t really know where to look in the Javadoc (I am just beginning :slight_smile:

So, my question is basically if I can somehow have some manual update loop in which I can tell the physics system to update more slowly (by passing less elapsed time). Does anyone know about this?



[java]speed = 0.2;[/java]

Thanks Normen. So, this is probably the “speed” member variable of the Application class? I expect this controls the speed of everything (including physics). Ok, I will try it.

Hi! I have tested your suggestion.

First, I have read somewhere in the documentation that the bullet simulation has an internal frequency of 60hz. Ok, so I have added the following line to simpleInitApp() in the HelloCollision tutorial:

speed = 1/60.0f;

It kind of works: the bullet simulation is indeed slowed down. BUT! It becomes quite noticeable that the bullet simulation is advanced only at 60Hz. Concretely, what this means for my speed of 1/60.0f is that the bullet simulation is stepped only once every second when I am looking at the screen. Sure my graphics have 729 FPS, but the world is only advanced every second.

I expected that the bullet simulation would do some nice interpolation between successive world states, so that I would see a smooth continuous slow motion effect. (I believe I have read about this in the native bullet documentation somewhere.)

Is this possible in the current implementation of JMonkey? Or should someone write a patch? :slight_smile:

Thanks for your help!

You mix a few things up. If you want it slower but with more simulation steps you have to up the number of simulation steps on the physics space (setAccuracy). Speed only slows down the general tpf time which the physics space uses. All in the docs.

Awesome, it works! I am happy now.

Thanks, ‘speed’ works fine!