self:get_gravity

Client

Retrieves the current combined gravity vector affecting the rigid body


Syntax

local gravity = self:get_gravity()

Parameters

No parameters are accepted by this function

Returns

TypeNameDescription
vector3gravityCurrent gravity vector as {x, y, z}

Examples

Get the gravity affecting a rigid body
local entity = physics.rigid.create()
local gravity = entity:get_gravity()

core.engine.print("info", "Rigid body gravity:", util.table.unpack(gravity))

On this page