Fix Camera 2D position not updating correctly #63083
Merged
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.
Currently,
SceneTree
's initialphysics_process_time
andprocess_time
are set to1
second. So early calls toget_process_delta_time()
orget_physics_process_delta_time()
return unreasonably large values, which causes incorrect calculations. Most notably inCamera2D
's initial position when smoothing is enabled:godot/scene/2d/camera_2d.cpp
Lines 158 to 161 in 5a6b13b
In addition, when a
Camera2D
's limits are updated, the camera's position is not updated. This is requiring users to unnecessarily, manually call the hidden_update_scroll()
method.This PR fixes both these issues by setting
SceneTree
's initial process times to0
and calling_update_scroll()
when setting limits. It also fixesscene_tree.h
's clang formatting, required to make changes toscene_tree.h
and aTestEdit
test that depends onSceneTree
's initial process times being arbitrarily greater than0
.Fixes #56336
Fixes #56913