-
-
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
apply_impulse is not intuitive #21634
Comments
This happens because |
It's because it uses local position but world rotation |
@raymoo Indeed, but do you find it intuitive to have a position that is neither a World Position nor a Local Position ? I find " local position but world rotation" un-intuitive when we could just have a world position. |
It's intuitive in the case that the impulse comes from an external source. In that case you don't want the rotation to affect the direction of the force |
Hum, here is what I understand :
For eg in Unreal Engine AddForceAtLocation will take the force direction in World Space (like in Godot) and the impulse position in World Space (in Pink on the drawing). Then AddForceAtLocationLocal will take the force direction in Local Space and the impulse position in Local Space (in Yellow on the drawing), the equivalent in Godot would be #20031. But for Maybe I completely misunderstood, but in case I got this right, then this Blue point does not correspond to the position of anything in any space, but corresponds to the offset between the rigidbody center and the impulse position. In that case I think we should :
Both the impulse and the position are in global coordinates, and the position is relative to the object’s origin. To maybe something like :
|
Related: #16863 (comment) We may have something like |
For The problem is for If we choose to use the global position like the other engines, it would be a good idea to do it at the same time as #16863 as this would also break compat |
Why is offset the first argument in |
This was fixed in #37350, closing. |
Godot version:
3.1, 9eb4d4a
Issue description:
The function
void apply_impulse( Vector3 position, Vector3 impulse )
is not intuitive to use.What we would expect is :
So let's say we have a rigid body and we want to apply an impulse at an offset of 2 on the Y axis of the rigid body (i.e the impulse point is at (0,2,0) in local coordinates) with a force along the X axis of the rigid body (i.e the force vector is for eg (1,0,0) in local coordinates).
We should be able to do :
apply_impulse( to_global(Vector3(0,2,0)) , to_global(Vector(1,0,0) )
Or equivalently :
apply_impulse( to_global(Vector3(0,2,0)), transform.basis.x )
But this is not correct, instead we currently have to do :
apply_impulse(transform.basis.xform(Vector3(0,2,0)), transform.basis.x)
For e.g in Unity AddForceAtPosition seems much clearer and easier to understand : Force and Position are in global coordinates and that's it.
Same in Unreal Engine, Same in Lumberyard, etc...
The text was updated successfully, but these errors were encountered: