Skip to content

setObjectDynamicPhysics

Server-side

Opts an MTA object into GTA's own rigid-body physics, or back out of it.

Syntax

bool setObjectDynamicPhysics(object theObject, bool enabled)

Arguments

theObjectobject

Object created with createObject.

enabledbool

Whether the object is simulated by GTA physics.

Returns

true when the state was applied; false for an invalid object.

Ownership and lifecycle

The switch is server-side and travels with the object. Position, rotation, linear velocity and angular velocity are synchronized, so motion survives a syncer change and a stream-out/stream-in cycle. Collision is not generated; the object is simulated with whatever its model already has.

Important behavior
  • Once enabled, setElementVelocity and setElementAngularVelocity set real motion instead of being overwritten on the next sync tick.
  • The syncer sends position, rotation, linear velocity and angular velocity, so a rolling or spinning object keeps its motion through a syncer change.
  • This does not generate collision. The object is simulated with whatever collision its model already has, so a model without useful collision will not behave.
  • There is no separate tuning API: a physical object uses GTA's own object properties, so mass, turn mass, air resistance and elasticity come from setObjectProperty.

OOP aliases

  • object:setDynamicPhysics(enabled)
  • object.dynamicPhysics

Example

local ball = createObject(2114, x, y, z)
setObjectDynamicPhysics(ball, true)
setElementVelocity(ball, 12, 0, 3)
setElementAngularVelocity(ball, 0, 0.4, 0)

Where this comes from

RELATED NEON APIS

Continue exploring

Read the system guide →