-
-
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
Correct the doc about linear damping #42604
Conversation
6ac4ede
to
58e088a
Compare
Ok updated the descriptions to mention the physics fps, but I wonder if it can't be written better (and somehow mention the default value). |
Maybe we should actually use fixed |
So should I do it in this PR? Where is it calculated? |
|
That's an option, but it breaks compat so it should likely be in a separate PR. |
And somewhere else for the Bullet server, it's using the same calculation, since we have |
Mapping the values from a In Bullet the mapping only needs to happen here, when we're passing the values to Bullet: godot/modules/bullet/rigid_body_bullet.cpp Line 1001 in e93af13
|
First, it's worth pointing out that Godot damping, as it is currently implemented, is not physically accurate. If it was physically accurate, only values between 0 and 1 would be valid. However, as #19182 demonstrated, physically accurate damping is not intuitive. Accurate physical damping increases exponentially as values approach 1. Instead, to make Godot damping more intuitive, Godot damping is linear. Values less than 0.5 are pretty close to accurate, but noticeably less severe as they approach and pass 1.0. See the table I created here for a comparison. Godot damping is, as the documentation states: "the linear velocity lost per second", or perhaps more accurately, "the proportion of linear velocity lost per second". Although this can never be greater than 100%, values greater than 1 make sense, because the physics iteration rate is less than a second. Setting the damping to 2 will aim to decrease the velocity to 0 in half a second. Although, it's worth noting that at the next iteration, the velocity will be less; so the actual velocity lost with each iteration (being proportional to the velocity) will be less too. Setting damping to 100 will aim to decrease velocity to 0 in 10ms. Damping is not limited by the physics iteration rate. It is limited by the accuracy of the physics engine, which is limited by the physics iteration rate. In other words, setting the damping equal to the physics iteration rate (by default 60) will reduce the velocity by 100% in one physics iteration. Values greater than the physics iteration rate won't make a difference, because the body will be stopped regardless. Bearing all that in mind. I think a range of 0 - 100 is right. Any more would not be noticeable - even at higher physics iteration rates. There is definitely no need to scale it - just to fit into the notion that it should only be between 0 and 1. It is currently both meaningful and accurate at normal, low values less than 0.5. All that been said, my suggestion for the wording is therefore:
|
Soo this long node should be for all four properties? Since it's relevant for any damping, maybe it should be documented in one place and we could just link to it? |
Since
|
d7c2600
to
ae084fb
Compare
Ok so I copied bruvzg's note to |
Last nitpicks, then it's good to go. Good call on also adding the note for both 2D and 3D in the ProjectSettings. |
Thanks! |
Cherry-picked for 3.2.4. |
Resolves #33676
Seems like the doc was wrong, because there is visible difference between 1 damp and 100 damp. Also the values in Project Settings and RigidBody go from 0 to 100 too.