Fix kinematic bodies not synchronizing state when using Jolt Physics #101803
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.
Fixes #101753.
Prior to #100983 we relied on a
JoltBody3D::sync_state
flag to indicate whether a rigid/kinematic body should have its state synchronized on the nextPhysicsServer3D::flush_queries
, but as of #100983 the Jolt Physics module now does the same kind of "self-listing" as Godot Physics, where each body registers with its respective physics space to have itscall_queries
invoked.However, it seems I had forgot to replace one important
sync_state = true
with the new_enqueue_call_queries
, which was the one happening inJoltBody3D::_move_kinematic
, meaning we now never invoke state synchronization for things likeAnimatableBody3D
, which relies on this for itssync_to_physics
property.With this PR we now instead always
_enqueue_call_queries
if any activeJoltBody3D
has a valid state synchronization callback or a valid custom integration callback before stepping the simulation, which should bring it in line with Godot Physics.(I also removed/inlined
_pre_step_rigid
and_pre_step_kinematic
as they felt a bit excessive now.)