self:apply_force

Client

Applies a continuous force to the vehicle body at a specific position, inducing torque, for the current physics step


Syntax

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

Parameters

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

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Apply an off-center force
local entity = physics.vehicle.create()

entity:apply_force({0, 20, 0}, {1, 0, 0})

On this page