Skip to content

Jolt physics: wake up a soft body when its transform changes #108094

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

Merged
merged 1 commit into from
Jul 3, 2025

Conversation

simpkins
Copy link
Contributor

This updates JoltSoftBody3D::set_transform() to wake up the soft body after changing the transform.

Previously, if you had a soft body that was sleeping in a steady state on a ground plane, and you then translated it upwards by 1 meter it would just hang in the air. Now it falls to the ground correctly.

Issue #108090 has some details and an MRP (although that issue is mostly about other problems in SoftBody3D iteself).

This updates `JoltSoftBody3D::set_transform()` to wake up the
soft body after changing the transform.

Previously, if you had a soft body that was sleeping in a steady state
on a ground plane, and you then translated it upwards by 1 meter it
would just hang in the air.  Now it falls to the ground correctly.

Issue godotengine#108090 has some details and an MRP (although that issue is mostly
about other problems in SoftBody3D iteself).
@simpkins simpkins requested a review from a team as a code owner June 29, 2025 00:00
@AThousandShips AThousandShips added this to the 4.5 milestone Jun 30, 2025
@AThousandShips AThousandShips added the cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release label Jun 30, 2025
@Calinou
Copy link
Member

Calinou commented Jun 30, 2025

Should we check if the new transform is different from the old one before calling wake_up()? I don't know if we do this with other body types currently.

@mihe
Copy link
Contributor

mihe commented Jun 30, 2025

I don't know if we do this with other body types currently.

We do not. Both the Jolt and Godot Physics servers will wake RigidBody3D up when setting any transform.

It's easy enough to change I guess, but you shouldn't really be hammering RigidBody3D with the same any transform over and over in the first place, as that has been shown to cause all kinds of jank, so I'm not sure that's a use-case worth catering to. I would imagine that holds true for SoftBody3D as well.

EDIT: Oh right, there's not really a transform to compare against in the case of soft bodies anyway, since it's all just a lose collection of points, so nevermind I guess. On top of that we're forced to interpret the transform as relative. So I guess the best we could do is check if it's an identity matrix being set.

@Repiteo Repiteo merged commit b7dcb1f into godotengine:master Jul 3, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jul 3, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release topic:physics topic:3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants