ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setVehicleGravity

Function

setVehicleGravity

ServerVehiclesIdentical to MTA:SA

Stores a custom gravity direction for a vehicle as a vector (0, 0, -1 by default, i.e. down). This allows e.g. driving on walls.

Syntax

bool setVehicleGravity(vehicle vehicle, float x, float y, float z)

Arguments

vehiclevehicle
The vehicle.
xfloat
X component of the direction (or a vector).
yfloat
Y component.
zfloat
Z component.

Returns

true on success.

Example

local vehicle = createVehicle(411, 2000, -1690, 13.5)
setVehicleGravity(vehicle, 0, 1, 0)

Notes

State for scripts. The vehicle in the game still falls down; the global gravity strength is changed with setGravity.

See also