Can I "fast-forward" physics?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Haseb

Hi! I’m making a game sort of like breakout. My question is: is there any way to “fast-forward” physics without changing the result? Because the ball sometimes goes almost horizontally and takes too much time to get to the bottom. It’s not about calculation speed. I just want to make the ball fall more quickly so I don’t have to wait for it. I’m probably able to do it with lines of code but there are several moving objects apart from the ball so I’m wondering if there is an easy way to control the speed all at once. Thank you :slight_smile:

:bust_in_silhouette: Reply From: Calinou

You can control the engine’s time scale (which will affect physics) by setting Engine.time_scale to a floating-point number in a script. Values above 1.0 will result in a faster game and values below 1.0 will result in a slower game.

(In Godot 2.1, use OS.set_time_scale() instead.)

This is exactly what I’m looking for. Thank you so much! I also needed to set Engine.iterations_per_second to get the same result.

Haseb | 2018-05-13 00:42