addForce: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " " to " ")
No edit summary
Line 8: Line 8:


| Applies force to given object at given position. Force is defined as vector [x, y, z] in world space, position is vector [x, y, z] in model space. If you need to define force in model space, use [[vectorModelToWorld]] or [[vectorModelToWorldVisual]] commands first. The force applied as impulse. For more information see [http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/classPxRigidBody.html#a22b0a1ef0b6c5656a6063c5c38f5679c NVIDIA docs]
| Applies force to given object at given position. Force is defined as vector [x, y, z] in world space, position is vector [x, y, z] in model space. If you need to define force in model space, use [[vectorModelToWorld]] or [[vectorModelToWorldVisual]] commands first. The force applied as impulse. For more information see [http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/classPxRigidBody.html#a22b0a1ef0b6c5656a6063c5c38f5679c NVIDIA docs]
{{Feature|Informative|Since Arma 3 v2.03.147267 this command can be used on units. It will send the unit into unconscious ragdoll state, similar to how [[setUnconscious]] does it (see example 3)}}
| object '''addForce''' [force, position]
| object '''addForce''' [force, position]
|p1= object: [[Object]] - PhysX object
|p1= object: [[Object]] - PhysX object
Line 20: Line 21:
|x2= Apply force [0,1000,0] defined in model space (relative to object) to object position [1,0,0]:
|x2= Apply force [0,1000,0] defined in model space (relative to object) to object position [1,0,0]:
<code>_object [[addForce]] [_object [[vectorModelToWorld]] [0,1000,0],[1,0,0]];</code>
<code>_object [[addForce]] [_object [[vectorModelToWorld]] [0,1000,0],[1,0,0]];</code>
|x3= Since Arma 3 v2.03.147267, can be used on units: <code>[] [[spawn]]
{
bob [[addForce]] [bob [[vectorModelToWorld]] [0,-200,0], bob [[selectionPosition]] "rightfoot"];
[[sleep]] 5;
bob [[setUnconscious]] [[false]];
};</code>
|[[addTorque]], [[vectorModelToWorld]], [[vectorModelToWorldVisual]]
|[[addTorque]], [[vectorModelToWorld]], [[vectorModelToWorldVisual]]
}}
}}

Revision as of 01:11, 12 February 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Object Manipulation

Syntax

Syntax:
Syntax needed
Parameters:
object: Object - PhysX object
[force, position]: Array
force: Array - force vector (in world space) in format [x,y,z]
position: Array - model PositionRelative to which force is applied in format [x,y,z]
Return Value:
Return value needed

Examples

Example 1:
Apply force [0,1000,0] defined in world space (not factoring object actual positioning) to object position [1,0,0]: _object addForce [[0,1000,0],[1,0,0]];
Example 2:
Apply force [0,1000,0] defined in model space (relative to object) to object position [1,0,0]: _object addForce [_object vectorModelToWorld [0,1000,0],[1,0,0]];
Example 3:
Since Arma 3 v2.03.147267, can be used on units: [] spawn { bob addForce [bob vectorModelToWorld [0,-200,0], bob selectionPosition "rightfoot"]; sleep 5; bob setUnconscious false; };

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note