Skip to content
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

Time scale individual for each node #3425

Closed
ghsoares opened this issue Oct 14, 2021 · 3 comments
Closed

Time scale individual for each node #3425

ghsoares opened this issue Oct 14, 2021 · 3 comments

Comments

@ghsoares
Copy link

Describe the project you are working on

A fast-paced arcade game

Describe the problem or limitation you are having in your project

I want to add a feature to my game where I slow down time in a given area, so any body that enters this area it becomes slower than the bodies outside this area. I wanted to be able to override physics time scale and idle time scale, individually for each node.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The feature is two overridable functions: _get_physics_time_scale and _get_idle_time_scale for any Node type. These functions return 1.0 by default, but you can override it to return any time scale. These time scales only impacts the individual node.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

In the start of the physics processing of a node (including internal), the engine would call _get_physics_time_scale, which stores the returned number in a cached variable internally (let's call it c_physics_time_scale). So whenever the function get_physics_process_delta_time is called, the returned value is multiplied by c_physics_time_scale, so there is no need to call _get_physics_time_scale everytime get_physics_process_delta_time is called.

The same would work for idle processing, but it would call _get_idle_time_scale and store it to c_idle_time_scale which is used in get_process_delta_time.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Nope, there is currently no way to change internal processing behaviour.

Is there a reason why this should be core and not an add-on in the asset library?

Because requires internal physics and idle processing behaviour change.

@Zireael07
Copy link

Been already suggested and rejected (I can't recall the issue # though), because "you can work around it in scripts" to put it short.

@YuriSizov
Copy link
Contributor

Indeed. Duplicate of #2507

@ghsoares
Copy link
Author

What about internal processing? There is no way to work around with internal processing in gdscript. For physics server I'm not sure, but maybe passing the objects individual time scale before solving physics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants