- Documentation
- Server functions
- setVehicleGravity
Function
setVehicleGravity
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
getVehicleGravityReturns the vehicle's gravity direction stored withsetVehicleGravity(0, 0, -1 by default).setGravityChanges the gravity strength in the game world for every player. The default is 0.008; a smaller value gives higher jumps and longer car flights (e.g. 0.004 = half of Earth's). The game accepts values above 0 and below 1.