self:add_constant_force

Client

Adds a persistent force to the rigid body at a specific position, applied every physics step until cleared


Syntax

local status = self:add_constant_force(
    force,
    position = {0, 0, 0}
)

Parameters

TypeNameDescription
vector3forceForce vector to add as {x, y, z}
vector3positionWorld-space position offset to apply the force at

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Add a constant off-center force
local entity = physics.rigid.create()

entity:add_constant_force({0, 9.8, 0}, {1, 0, 0})

On this page