RemoteTransform2D
may fail to update AnimatableBody2D
's position or rotation
#75486
Labels
Milestone
RemoteTransform2D
may fail to update AnimatableBody2D
's position or rotation
#75486
Godot version
v4.1.dev.custom_build [c29866d], v4.0.1.stable.official [cacf499]
System information
Linux Mint 21.1, Vulkan API 1.3.205, NVIDIA GeForce GTX 1050 Ti
Issue description
When
update_position
,update_rotation
,update_scale
are not enabled at the same time, for anAnimatableBody2D
withsync_to_physics
enabled,RemoteTransform2D
may not be able to update the position or rotation of theAnimatableBody2D
.This is related to the following code:
godot/scene/2d/remote_transform_2d.cpp
Lines 79 to 85 in c29866d
For an
AnimatableBody2D
withsync_to_physics
enabled, after setting the transform, and then calling a method (here, it'sset_scale()
) that may issue aNOTIFICATION_LOCAL_TRANSFORM_CHANGED
notification, the following code will be called twice.godot/scene/2d/physics_body_2d.cpp
Lines 298 to 308 in c29866d
In the second call, line 302 sets the physics state with an outdated value. It may cause jitter or even failure.
It will become a duplicate of #58269 whenuse_global_coordinates
is disabled. It may be appropriate to useNOTIFICATION_TRANSFORM_CHANGED
instead ofNOTIFICATION_LOCAL_TRANSFORM_CHANGED
inAnimatableBody2D
.Steps to reproduce
Minimal reproduction project
fail-to-update.zip
The text was updated successfully, but these errors were encountered: