BGE: Fix for applyImpulse function
This is related to task T29419. Credit also goes to Goran Milovanovic (goran) for proposing an initial fix for this issue. The issue is the current behavior of applyImpulse doesn't match the behavior described in the documentation as instead of a impulse point in world coordinates, it seems to require a coordinate in a local space. Additionally, applyImpulse function isn't consistent with similar functions (applyForce, applyTorque, etc) as it doesn't allow to choose in which space (local or global) the impulse is applied. Now, we have the following function: applyImpulse(point, impulse, local=False) being "point" the point to apply the impulse to (in world or local coordinates). When local is False will have both point and impulse in World space and when local is True will have point and impulse in local space. Reviewers: moguri, dfelinto, brita_ Reviewed By: moguri Differential Revision: https://developer.blender.org/D567
This commit is contained in:

committed by
Mitchell Stokes

parent
ef22e972b1
commit
1f43b083a9
@@ -551,7 +551,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
This is not implimented at the moment.
|
||||
|
||||
.. method:: applyImpulse(point, impulse)
|
||||
.. method:: applyImpulse(point, impulse, local=False)
|
||||
|
||||
Applies an impulse to the game object.
|
||||
|
||||
@@ -559,8 +559,14 @@ base class --- :class:`SCA_IObject`
|
||||
If point != position, applyImpulse will also change the object's angular momentum.
|
||||
Otherwise, only linear momentum will change.
|
||||
|
||||
:arg point: the point to apply the impulse to (in world coordinates)
|
||||
:type point: the point to apply the impulse to (in world coordinates)
|
||||
:arg point: the point to apply the impulse to (in world or local coordinates)
|
||||
:type point: point [ix, iy, iz] the point to apply the impulse to (in world or local coordinates)
|
||||
:arg impulse: impulse vector.
|
||||
:type impulse: 3D Vector
|
||||
:arg local:
|
||||
* False: you get the "global" impulse ie: relative to world coordinates with world orientation.
|
||||
* True: you get the "local" impulse ie: relative to local coordinates with object orientation.
|
||||
:type local: boolean
|
||||
|
||||
.. method:: suspendDynamics()
|
||||
|
||||
|
Reference in New Issue
Block a user