addTorque: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("serv...)
Line 1: Line 1:
{{Command|Comments=
{{Command
|arma3 |= Game
|arma3 |= Game
|1.72|Game Version=
|1.72
|arg= global |Multiplayer Arguments=
|arg= global |Multiplayer Arguments=
|eff= global |Multiplayer Effects=
|eff= global |Multiplayer Effects=


|gr1= Object Manipulation |GROUP1=
|gr1= Object Manipulation
|Applies torque (rotation momentum) to the [[getCenterOfMass | center of mass]] of the given object. Torque force is defined as vector [x, y, z] applied in world space. If you need to define torque in model space, convert the torque vector first by [[vectorModelToWorld]] or [[vectorModelToWorldVisual]] command. The torque applied as impulse. Diagram below explain which way the object would rotate.  For more information see [http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/classPxRigidBody.html#acb04ffc816d45afff2d04e93d7446e79 NVIDIA docs] <br>
|Applies torque (rotation momentum) to the [[getCenterOfMass | center of mass]] of the given object. Torque force is defined as vector [x, y, z] applied in world space. If you need to define torque in model space, convert the torque vector first by [[vectorModelToWorld]] or [[vectorModelToWorldVisual]] command. The torque applied as impulse. Diagram below explain which way the object would rotate.  For more information see [http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/classPxRigidBody.html#acb04ffc816d45afff2d04e93d7446e79 NVIDIA docs] <br>
[[Image:addTorque_correct.jpg|400px]]
[[Image:addTorque_correct.jpg|400px]]
{{Informative | A single application of torque would produce one impulse, which may not be enough. In this case consider applying a series of continuous impulses, for example to make a quad bike to roll forward:
{{Informative | A single application of torque would produce one impulse, which may not be enough. In this case consider applying a series of continuous impulses, for example to make a quad bike to roll forward:
<code>[[onEachFrame]] { quad [[addTorque]] (quad [[vectorModelToWorld]] [100,0,0]) }</code>}}
<code>[[onEachFrame]] { quad [[addTorque]] (quad [[vectorModelToWorld]] [100,0,0]) }</code>}}
{{Important |This command doesn't follow convention for torque direction, which obeys right-hand rule. To comply, negate all values in the vector. }}|DESCRIPTION=
{{Important |This command doesn't follow convention for torque direction, which obeys right-hand rule. To comply, negate all values in the vector. }}
| object '''addTorque''' torque |SYNTAX=
| object '''addTorque''' torque
|p1= object: [[Object]] - PhysX object|PARAMETER1=
|p1= object: [[Object]] - PhysX object
|p2= torque: [[Array]] - world vector in format [x,y,z] |PARAMETER2=
|p2= torque: [[Array]] - world vector in format [x,y,z]
|p3=  |PARAMETER3=
|p3=
|p4=  |PARAMETER4=
|p4=
|p5=  |PARAMETER5=
|p5=
|p6=  |PARAMETER6=
|p6=
| [[Nothing]] |RETURNVALUE=
| [[Nothing]]
|x1= Apply torque [1000,0,0] to object not factoring object positioning:
|x1= Apply torque [1000,0,0] to object not factoring object positioning:
<code>_wheel [[addTorque]] [1000,0,0];</code>|EXAMPLE1=
<code>_wheel [[addTorque]] [1000,0,0];</code>
|x2= Apply torque [1000,0,0] relative to object:
|x2= Apply torque [1000,0,0] relative to object:
<code>_wheel [[addTorque]] (_wheel [[vectorModelToWorld]] [1000,0,0]);</code>|EXAMPLE2=
<code>_wheel [[addTorque]] (_wheel [[vectorModelToWorld]] [1000,0,0]);</code>
|[[addForce]], [[vectorModelToWorld]], [[vectorModelToWorldVisual]] |SEEALSO=
|[[addForce]], [[vectorModelToWorld]], [[vectorModelToWorldVisual]]
}}
}}



Revision as of 01:04, 18 January 2021

Hover & click on the images for description

Description

Description:
Applies torque (rotation momentum) to the center of mass of the given object. Torque force is defined as vector [x, y, z] applied in world space. If you need to define torque in model space, convert the torque vector first by vectorModelToWorld or vectorModelToWorldVisual command. The torque applied as impulse. Diagram below explain which way the object would rotate. For more information see NVIDIA docs
addTorque correct.jpg
A single application of torque would produce one impulse, which may not be enough. In this case consider applying a series of continuous impulses, for example to make a quad bike to roll forward: onEachFrame { quad addTorque (quad vectorModelToWorld [100,0,0]) }
This command doesn't follow convention for torque direction, which obeys right-hand rule. To comply, negate all values in the vector.
Groups:
Object Manipulation

Syntax

Syntax:
object addTorque torque
Parameters:
object: Object - PhysX object
torque: Array - world vector in format [x,y,z]
Return Value:
Nothing

Examples

Example 1:
Apply torque [1000,0,0] to object not factoring object positioning: _wheel addTorque [1000,0,0];
Example 2:
Apply torque [1000,0,0] relative to object: _wheel addTorque (_wheel vectorModelToWorld [1000,0,0]);

Additional Information

See also:
addForcevectorModelToWorldvectorModelToWorldVisual

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

Bottom Section