-
-
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
Improve RigidDynamicBody force and torque API #55736
Improve RigidDynamicBody force and torque API #55736
Conversation
1121520
to
2023a1b
Compare
I do not see how this PR makes "forces and impulses more flexible, easier to understand." Adding more methods and having two do the same thing is not making things easier to understand or more flexible. The way 2D works at the moment is already flexible and easy to understand. #42850 makes 3D the same as 2D (harmonizing 2D and 3D."). As stated previously in the proposal: I'm not convinced that the arguments:
justify adding a third set of methods presented in this PR:
I addressed each argument individually there, but I'll repeat them here to ensure they're captured:
A one-shot force is an impulse, which can be applied directly using
With #42850 this would simply require a single line of code: Note: This is how it works in 2D at the moment! #42850 is simply making 3D the same as 2D. It's just making them consistent. It's not introducing anything new. As per the best practices, we need one solution for each problem. We should not have multiple methods doing the same thing. |
3ec6898
to
094049f
Compare
I quite frankly disagree with @madmiraal. I believe in 99% of use cases that most people would need to include your line of As for the removal of I agree with this PR as implemented. +1 |
I've previously provided demo projects showing that As per the best practices, there needs to be a problem before providing a solution. So far I have not seen anyone provide a practical example that demonstrates a problem with using |
@madmiraal Copy-pasting the same arguments over and over again in different places without adding to the discussion is not helping. Your concerns have been previously addressed, in the original PR, here and in the proposal. Please discontinue. |
Please show me where anyone has provide a practical example that demonstrates a problem with using I cut and paste my arguments, because they have not been incorporated into the discussion and my concerns have not been addressed. I specifically provide references to the previous comments to highlight this. |
As a non-physics expert, allow me: The point of an API is to provide a simple to understand system that requires the least knowledge of its inner workings. For a person competent with physics and the associated maths, having only apply_impulse(* delta) might make more sense, but for a person that doesn't have the time to learn the details of how physics work, apply_force() and apply_impulse() are much easier to understand since they use the proper wording of force and impulse rather than mathematical applications that the underlying system uses. If you believe that clearer wording should come second to logical correctness, I would agree with you for the internals, but that is simply not applicable to an API. I'm quite confident as a user that 99% of other users of Godot do not want to have to learn how the physics work but just to get it working ASAP, and using proper English is the simplest way to do it. |
@KingArrkinian I agree. This is exactly the point I'm trying to make. |
There is a difference between: This PR provides an API for all three uses cases, and are now arguing over semantics, which I believe this PR with its wording makes very clear each use case. There are already plenty examples, as I gave one in my previous post with At the very least, let this PR be merged, and create a new Proposal with your suggested changes to discuss it there. |
Great, this proves enough information was provided and you agree with me on this PR. |
Makes the API for forces and impulses more flexible, easier to understand and harmonized between 2D and 3D. Rigid bodies now have 3 sets of methods for forces and impulses: -apply_impulse() for impulses (one-shot and time independent) -apply_force() for forces (time dependent) applied for the current step -add_constant_force() for forces that keeps being applied each step Also updated the documentation to clarify the different methods and parameters in rigid body nodes, body direct state and physics servers.
094049f
to
940f3fd
Compare
No. @KingArrkinian describes 99% of users' expectation of the API, which is the current 2D API, and which I agree is the correct one. To convince me of this PR, all I ask for is a practical example (i.e. a sample Godot project) that demonstrates a problem with using |
@madmiraal Also, the reason I found this issue is that I was bitten by forces not being cleared as I expected in 2D, which makes me doubt your claim that 99% of the users expect forces not to clear. Can you present the numbers pointing to that fact? |
Makes the API for forces and impulses more flexible, easier to understand and harmonized between 2D and 3D.
Rigid bodies now have 3 sets of methods for forces and impulses:
-
apply_impulse()
for impulses (one-shot and time independent)-
apply_force()
for forces (time dependent) applied for the current step-
add_constant_force()
for forces that keep being applied each stepAlso updated the documentation to clarify the different methods and parameters in rigid body nodes, body direct state and physics servers.
Simple script examples to show usage for different cases:
Apply Impulse
Apply Force
Add Constant Force
Fixes #38646
Closes godotengine/godot-proposals#3601
Supersedes #42850