-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Improved RigidDynamicBody linear/angular damping override #37880
Improved RigidDynamicBody linear/angular damping override #37880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect!
89dcb58
to
8aac640
Compare
From comment in #37316:
Has this decision been made? Because this is a compact breaking decision; especially considering this change would also need to be made in 2D to make them consistent. The reasoning seems to be based on the way Bullet was implemented; so one could just as easily deem it a bug in the Bullet implementation. Personally, I think it's a bug in the way Bullet was implemented, and we should be fixing Bullet not changing Godot physics. There is also an issue with the way this change will work when there are no areas, or, more specifically, only the default world area. The Slightly off topic, but testing this also highlighted another issue with the current Bullet implementation: The |
The reasoning behind this change is based on @AndreaCatania's comment in #37316 (comment):
This is a use case that seems pretty useful (custom damping on specific bodies & override in some areas) and it is not possible in the current implementation. On the other hand, setting things the other way around (forcing a specific custom damping on the body whatever the area it's in) can be easily achieved by setting the right collision mask on the area itself. Because of these scenarios, I think it's a good idea to make this change for 4.0. As you already mentioned, since Bullet and Godot Physics don't work the same way right now, any change to make things consistent will break compatibility in some way.
This is a good point. In order to handle this case, what about making it so the rigid body's damping overrides the default world damping rather than adding to it? And then we can apply the current process to combine the damping with other areas. Also, I agree the same logic should be applied to 2D physics once we reach a consensus on what to do for 3D. |
Please excuse me for paraphrasing to make a point:
I suppose the real question is: why would a user use the Drilling down even further: why does the To answer the question:
Yes, if set, the body's setting should at least override the default world setting, otherwise it would never be used. Finally, just to respond to:
I suppose any bug fix could be classified as breaking compatibility. The question is, how long does a bug have to exist before fixing it counts as breaking compatibility? :-) |
About setting damping on rigid bodies: In practice, damping is not used just as an environment parameter. It's used a lot to simulate specific bodies' movements and tweak the lag when movements stop. That's why it's important to keep damping settings in the body itself, and allow different combinations to handle multiple use cases around that. As for an example scenario where you need body & area settings: Specific damping settings can also help configuring the physics for pushable objects, or rotations using joints, so there can be many other examples. Because of that, unless there's a specific reason not to support it, I would go for a solution that doesn't limit users. About breaking compatibility: |
So do we have a consensus here? From what I read @AndreaCatania seems in favor of the change, but I'm not sure @madmiraal is convinced yet. Maybe @reduz can chime in too? |
Although I understand the arguments for changing the behaviour i.e. allow More importantly, even if it is decided that Furthermore, if it is decided that Personally, I still think it is Bullet physics that should be fixed to ensure |
Once a decision is made, documentation can be changed (it's already part of this PR), this PR can be updated to make rigid body settings override the default world settings, and 2D Physics can be modified to keep things consistent. The question we need to answer first is: do we want to change the design to allow users to set specific damping values on different rigid bodies, and override these values in some areas? I'm advocating for making the change in design, because it would allow users to achieve more possible scenarios very easily, and afaik wouldn't prevent existing scenarios to be achieved just as easily. |
@godotengine/physics Did we reach any consensus here in the end? |
@akien-mga We did, I just haven't found the time (yet) to make the changes we agreed on. Here are the details for info.
It will default to Combine with value 0, which is the same as the current default -1 value (it uses world/area values). For non-default values:
|
Bodies should have three
|
@madmiraal As we already discussed, adding an extra option for |
8aac640
to
ec722c4
Compare
835e01d
to
56af963
Compare
Damping values are now non-negative. Add new properties linear_damp_mode and angular_damp_mode to set the way RigidDynamicBody and PhysicalBone (2D & 3D) use damping values. It can now be Combine (default) to add to the default/areas, or Replace to override the value completely (current behavior).
56af963
to
daf7dca
Compare
👍 |
Changes discussed in #37316 (comment)
RigidBody3D and PhysicalBone3D damping is now non-negative.
Area3D can override RigidBody3D damping values, not the other way around.It's already how it works in Bullet, so the way damping is implemented had to be changed only in Godot Physics 3D.
CC @AndreaCatania
Edit:
Updated to use a new properties
linear_damp_mode
andangular_damp_mode
to set the wayRigidDynamicBody
andPhysicalBone
(2D & 3D) use damping values.It can now be
Combine
(default) to add to the default/areas, orReplace
to override the value completely (current behavior).Simple test project for 2D and 3D:
damping-override.zip