Physics – Scale Time

Nodes for controlling the scale/speed of processing physical elements:

The minimum value for the input parameter is 0.

Modified the PhysicsWorld class: added functions for input and output of the TimeScale value (so as not to process the value from the class directly).

In the Blender interface, this value is set here:

There is a Set Time Scale node, but it affects everything, and the new one specifically affects physics.

Demo: web

In the physics engine, you can configure the frequency (step) of calculations (processing physics), which affects the accuracy. Now this value is set depending on the value here:
BUT the code for specifying this parameter says:
maxSteps = timeStep < 1 / 60 ? 10 : 1;
which limits the configuration options.
As an optimization step, you can reduce the processing frequency, thereby reducing the accuracy that may not be necessary.
Could it be that it’s programmed this way and there are serious reasons for it? If not, I will correct the class code and make logical nodes.


Could it be Set Physics Scale Time or Set PW Scale Time?

I can’t see a need to set only the physics process scale, but it may be useful sometime. Is not better to just add a drop box in the Set Time Scale node for “Physics Only” and “Scene” (if this affects only the active scene)? And for Get Time Scale i would create a new output just for the physics.

1 Like

As an example, you try to use this node with a free camera. If you set the Scale for everything, then the camera will move accordingly (that is, it also affects the Input), and when you change the physics, the rest works as usual and you can get an interesting effect of the game over time.

Nice idea, but there is a separate category for Physics and Scene, and the Set Time Scale node is under the Miscellaneous category. Maybe you should move it, but then where in the category of physics or scene?

Indeed! I didn’t thought about that. A new node should be reasonable to put it in physics category :slight_smile:

Also the camera example is good and also it would be cool to make that quantum break style mechanic :+1:

Leave the Set Time Scale from the Miscellaneous category as it is because it affects the entire application. If you set a value in one scene and switch to another, this “effect” will remain. Therefore, this is better separately.
The Set World Time Scale node only affects the physics in a particular scene, when switching the scene, the default settings will be set. Add it to the Physics category.

For Steps Per Second, everything works correctly, what I indicated in the first post is the minimum/maximum number of steps. The parameter itself works correctly. There is no point in creating logical nodes for them. I can’t think of a situation in which you need to change this value at runtime.