Skip to content
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

Update damping values for jolt rigid bodies on mode switch at runtime #100473

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

opsocket
Copy link
Contributor

Hi there 👋

Here's a fix for an issue where linear_damp and angular_damp are not updated when either linear_damp_mode or angular_damp_mode is changed at runtime.

Previously, linear_damp and angular_damp were computed once using their initial damping mode and not updated whenever a mode was changed.

It's likely that we want to split that update operation for each damping type.


I've made a short demo, cube A and B are the same but they change their linear damping mode when they collide with a floor surface, the red one changes the mode to REPLACE while the blue one changes the mode to COMBINE.
The initial mode is COMBINE for both and they have the same initial velocity in opposite directions.
The default linear damping value is .5.

damping.mp4

Here's the same demo without the fix (which means damping is not updated when cube A damping mode is changed when it first collides with the red surface)

damped.mp4

@opsocket opsocket requested a review from a team as a code owner December 16, 2024 15:23
@fire fire changed the title update damping values for jolt rigid bodies on mode switch at runtime Update damping values for jolt rigid bodies on mode switch at runtime Dec 16, 2024
Copy link
Contributor

@mihe mihe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed a bug, and the fix is the appropriate one. I only have some minor change requests.

@mihe mihe added this to the 4.4 milestone Dec 17, 2024
@opsocket opsocket requested a review from mihe December 17, 2024 22:17
@mihe
Copy link
Contributor

mihe commented Dec 17, 2024

Also, since it'll probably get brought up eventually, note that Godot's contribution workflow (seen here) specifies that pull requests should ideally be a single commit, so you'll need to squash (and force push) your commits yourself before the PR can be merged.

@AThousandShips
Copy link
Member

But there's no need to squash yet only when it's actually approved and ready to merge

@opsocket opsocket force-pushed the fix-rigid-bodies-damping branch from 7d4fb36 to 0dd072b Compare December 18, 2024 21:07
@Repiteo Repiteo merged commit 3a12fc8 into godotengine:master Dec 20, 2024
@Repiteo
Copy link
Contributor

Repiteo commented Dec 20, 2024

Thanks! Congratulations on your first merged contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants