Difference between revisions of "R3d.Body:applyWorldTorque"
From GiderosMobile
(Created page with "'''Available since:''' Gideros 2019.10<br/> '''Class:''' R3d.Body<br/> === Description === Applies a torque to the body. <syntaxhighlight lang="lua"> r3d.Body:applyWorldT...") |
|||
| Line 3: | Line 3: | ||
=== Description === | === Description === | ||
| − | Applies a torque to the body. | + | Applies a torque to the body in world-space. |
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
r3d.Body:applyWorldTorque(torqueX,torqueY,torqueZ) | r3d.Body:applyWorldTorque(torqueX,torqueY,torqueZ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | The specified force/torque will be added to the total force/torque applied to the rigid body. | ||
| + | |||
| + | At the end of each call to the ''PhysicsWorld::update()'', the total force/torque of all the rigid bodies will be reset to zero. You need to call ''applyLocalTorque'' during several frames if you want the force/torque to be applied during a certain amount of time. | ||
=== Parameters === | === Parameters === | ||
| − | '''torqueX''': (number) applies a torque on the X axis<br/> | + | '''torqueX''': (number) applies a torque in Newton meters on the X axis<br/> |
| − | '''torqueY''': (number) applies a torque on the Y axis<br/> | + | '''torqueY''': (number) applies a torque in Newton meters on the Y axis<br/> |
| − | '''torqueZ''': (number) applies a torque on the Z axis<br/> | + | '''torqueZ''': (number) applies a torque in Newton meters on the Z axis<br/> |
=== Example === | === Example === | ||
Latest revision as of 14:47, 16 December 2025
Available since: Gideros 2019.10
Class: R3d.Body
Description
Applies a torque to the body in world-space.
r3d.Body:applyWorldTorque(torqueX,torqueY,torqueZ)
The specified force/torque will be added to the total force/torque applied to the rigid body.
At the end of each call to the PhysicsWorld::update(), the total force/torque of all the rigid bodies will be reset to zero. You need to call applyLocalTorque during several frames if you want the force/torque to be applied during a certain amount of time.
Parameters
torqueX: (number) applies a torque in Newton meters on the X axis
torqueY: (number) applies a torque in Newton meters on the Y axis
torqueZ: (number) applies a torque in Newton meters on the Z axis
Example
if isleft then ship.body:applyWorldTorque(0, -24 * 64, 0) end
- R3d.Body
- R3d.Body.DYNAMIC BODY
- R3d.Body.KINEMATIC BODY
- R3d.Body.STATIC BODY
- R3d.Body:applyLocalForceAtCenterOfMass
- R3d.Body:applyLocalForceAtLocalPosition
- R3d.Body:applyLocalForceAtWorldPosition
- R3d.Body:applyLocalTorque
- R3d.Body:applyWorldForceAtCenterOfMass
- R3d.Body:applyWorldForceAtLocalPosition
- R3d.Body:applyWorldForceAtWorldPosition
- R3d.Body:applyWorldTorque
- R3d.Body:createFixture
- R3d.Body:destroyFixture
- R3d.Body:enableGravity
- R3d.Body:getAngularDamping
- R3d.Body:getAngularVelocity
- R3d.Body:getLinearDamping
- R3d.Body:getLinearVelocity
- R3d.Body:getMass
- R3d.Body:getTransform
- R3d.Body:raycast
- R3d.Body:setAngularDamping
- R3d.Body:setAngularVelocity
- R3d.Body:setIsAllowedToSleep
- R3d.Body:setLinearDamping
- R3d.Body:setLinearVelocity
- R3d.Body:setMass
- R3d.Body:setTransform
- R3d.Body:setType
- R3d.Body:testPointInside