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

Create a .force_physics_step(steps: int, delta: float) method to the PhysicsServer2D and PhysicsServer3D #7998

Closed
RadiantUwU opened this issue Oct 5, 2023 · 1 comment

Comments

@RadiantUwU
Copy link

RadiantUwU commented Oct 5, 2023

Describe the project you are working on

Roblox emulator, whole roblox runtime inside godot 4.2+

Describe the problem or limitation you are having in your project

Having to adhere to a whole task scheduler system that godot is quite different from
image
(All of the issues here could be solved by waiting for them or triggering them manually)

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

This feature would allow programmers to trigger physics steps arbitrarily for example while set_active is false.

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

extends Node
func _ready(): PhysicsServer3D.set_active(false)
func _force_step(start: float):
    var delta := Time.get_ticks_msec()/1000.0-start
    PhysicsServer3D.force_step(delta,4)
func _process(delta: float):
    # Force the engine to run physics 3D after _process
    _force_step.call_deferred(Time.get_ticks_msec()/1000.0-delta)

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

No.

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

There may be more use cases, for example moving the order of when to do physics step, maybe forcing it before rendering, or forcing physics to be synchronous to the step currently done.

@Calinou
Copy link
Member

Calinou commented Oct 5, 2023

Thanks for the proposal! Consolidating in #2821.

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

2 participants