-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
RigidBody2D
overwrites most transform changes done in _integrate_forces
#84919
Comments
One fairly simple and risk-free fix, in terms of breaking functionality, would be to simply remove these lines here: godot/scene/main/canvas_item.cpp Lines 888 to 896 in d5217b6
That would prevent the The only real downside, given that this is purely an optimization, is that you run the risk of introducing a potentially significant performance regression. It's hard to judge how severe exactly, but with a deep enough The only other solution I can think of is the alternative solution mentioned here, where you instead replace the Transform3D old_transform = get_global_transform();
GDVIRTUAL_CALL(_integrate_forces, p_state);
Transform3D new_transform = get_global_transform();
if (new_transform != old_transform) {
PhysicsServer3D::get_singleton()->body_set_state(get_rid(), PhysicsServer3D::BODY_STATE_TRANSFORM, new_transform);
} This would however also introduce a performance regression, since you're now adding the cost of updating the global transform for every single |
I've created a PR for the second solution mentioned in my previous comment, as #84924. I don't love it, but I'm running out of ideas. |
Godot version
4.2-beta [d5217b6]
System information
Windows 11 (10.0.22621)
Issue description
This is a formal issue for the partial regression caused by #84799, which in turn was meant to solve regression #83412 caused by #79977.
The summary of this issue is pretty much what the title says: Most transform changes done to a
RigidBody2D
from_integrate_forces
will have no effect due to them being overwritten by theRigidBody2D::_sync_body_state
call that happens after_integrate_forces
has been called.The one notable exception is if you first read some part of the global transform before modifying it within
_integrate_forces
, in which case theglobal_invalid
flag on theRigidBody2D
will be cleared and the transform change notification will actually be queued up and sent out by the eventualforce_update_transform
fromRigidBody2D::_body_state_changed
.See #84856 for a more in-depth breakdown of the problem.
Steps to reproduce
Minimal reproduction project
overwritten_transforms.zip
The text was updated successfully, but these errors were encountered: