Merge pull request #37350 from aaronfranke/force-impulse

Refactor physics force and impulse code to use (force, position) order
This commit is contained in:
Rémi Verschelde
2020-07-02 18:39:16 +02:00
committed by GitHub
35 changed files with 180 additions and 176 deletions

View File

@ -34,9 +34,9 @@
<method name="add_force">
<return type="void">
</return>
<argument index="0" name="offset" type="Vector2">
<argument index="0" name="force" type="Vector2">
</argument>
<argument index="1" name="force" type="Vector2">
<argument index="1" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Adds a positioned force to the body. Both the force and the offset from the body origin are in global coordinates.
@ -54,7 +54,7 @@
<method name="apply_central_impulse">
<return type="void">
</return>
<argument index="0" name="impulse" type="Vector2">
<argument index="0" name="impulse" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Applies a directional impulse without affecting rotation.
@ -63,9 +63,9 @@
<method name="apply_impulse">
<return type="void">
</return>
<argument index="0" name="offset" type="Vector2">
<argument index="0" name="impulse" type="Vector2">
</argument>
<argument index="1" name="impulse" type="Vector2">
<argument index="1" name="position" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
Applies a positioned impulse to the body. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason it should only be used when simulating one-time impacts (use the "_force" functions otherwise). The position uses the rotation of the global coordinate system, but is centered at the object's origin.