2D Physics Time Speed
-
Introduction
When you are using the 2D physics engine, the movement of every object is controlled by the physics engine. Normally the time in the physics world is the same as in the real world. However, you can speed up or slow down the physics world by changing its speed of time.
For example, suppose you want to show a slow-motion effect. A “bad” solution is to reduce the speed of every object, and also all the forces including gravity. A much simpler method is to slow down the time of the physics world.
Set Physics Time Speed
To change the speed of time in the physics world, you can run the following block after the physics world has been initialized.
When the input is 100, the speed of time in the physics world is the same as in the real world.If it is smaller than 100, time goes slower, which means all objects move slower. When the input is 0, time stops, which can be used to pause the game.
If the input is more than 100, then things move faster than in real time.