Add global way of accessing Delta time and Unscaled Delta time #112181
+77
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which seems to be pretty positively received and additionally seems to have a general consensus that both deltas and unscaled variants should be added to the Engine class
As such, I've added the following methods:
get_deltaprovides the exact same information the_processmethod provides.get_physics_deltais the same way but for_physicsProcessThe unscaled methods provide the user a unscaled version of both of these deltas, as they are never multiplied by timescale in the first place, this is the most accurate and convenient way of getting unscaled deltas.
Notes
This is a similar to #86766, just with the extra granularity, and I guess also slightly opinionated, it seemed like the consensus on the proposal was to refer to them as Deltas, makes sense to me and matches what the average user would expect I think.
As far as implementation goes, I'm aware im duplicating process_step here, but I'm not entirely sure how to cleanly handle this.
get_process_stepfunction (its only used a handful of times internally) and replace it with the newget_unscaled_delta, but I'm worried this will break compatibility with something else.get_unscaled_delta, and have it live throughget_process_step(while still being exposed to the scripting api asget_unscaled_delta, but it feels silly to haveget_process_steplive alongside the more conventionally named deltas.Screencast_20251029_210032.webm