-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to set a separate time scale for the physics simulation #1243
Comments
There is an open PR which adds time_scale as a property of Node, not on the engine level. Which probably covers this adequately. godotengine/godot#29861 |
Cool! yes, that should do it! =) |
@kilojool This proposal can be kept open until we reach an agreement on the pull request (upon which it'll be merged or closed). Therefore, I reopened it as it's still relevant. |
Thanks for making this feature request. Something like this would be very useful. It would also be cool to have an option to keep the delta time fixed while while changing time step. A fixed delta is important to keep physics stable. See this PR as well: lawnjelly/godot@55ddf46 |
Sadly, this PR was closed. I would love to have a per-rigid body time scale. It seems like we could do something like: while (b) {
b->self()->integrate_forces(p_delta * b->time_scale);
b = b->next();
active_count++;
} in GodotStep3D::step(). |
Describe the project you are working on:
An action game with bullet time features
Describe the problem or limitation you are having in your project:
Changing the Engine.time_scale effects all time-based processes such as UI, while I only want it to effect the gameplay. While most things can be worked around by multiplying the delta parameter in process or physics_process, there does not seem to be any other way to change the time_scale for the physics simulation.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Add a new variable called physics_time_scale_factor which is multiplied by Engine.time_scale to be used in the physics engine simulation.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
I have tried an implementation which adds a physics_time_scale_factor variable to engine.h which is multiplied by the time_scale.
This value is then passed to the PhysicsServer instead. In my implementation I pass it to every function call inside the physics_frame, which means that _physics_process uses the new new physics_time_scale, while _process still uses the old time_scale.
This might cause some confusion of course, but I still think it is worth it if documented properly.
For example, move_and_slide works as intended inside _physics_process, while you can still use UI or camera with the unmodified delta values inside _process or in animations.
in main.cpp
Letting physics_time_scale_factor have a default value of 1 also means that the old workflow still works as intended.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
The physics engine simulation time scale can not be changed except for changing Engine.time_scale, which also effects everything else.
Is there a reason why this should be core and not an add-on in the asset library?:
The implementation is in core.
The text was updated successfully, but these errors were encountered: