R3d.Body:applyWorldForceAtCenterOfMass: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
 
Line 3: Line 3:


=== Description ===
=== Description ===
Applies a force to the body.
Applies a force to the body in world-space.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
r3d.Body:applyWorldForceAtCenterOfMass(forceX,forceY,forceZ[,pointX,pointY,pointZ])
r3d.Body:applyWorldForceAtCenterOfMass(forceX,forceY,forceZ[,pointX,pointY,pointZ])

Latest revision as of 10:17, 18 December 2025

Available since: Gideros 2019.10
Class: R3d.Body

Description

Applies a force to the body in world-space.

r3d.Body:applyWorldForceAtCenterOfMass(forceX,forceY,forceZ[,pointX,pointY,pointZ])

If the force is applied to the center of mass, no torque will be created and only the linear motion of the body will be affected.

Parameters

forceX: (number) applies a force in Newton on the X axis
forceY: (number) applies a force in Newton on the Y axis
forceZ: (number) applies a force in Newton on the Z axis
pointX: (number) offsets the point of the force on the X axis (optional default is 0)
pointY: (number) offsets the point of the force on the Y axis (optional default is 0)
pointZ: (number) offsets the point of the force on the Z axis (optional default is 0)

Example

if isup then ship.body:applyWorldForceAtCenterOfMass(0, 0, 64) end