- Documentation
- Shared functions
- isVehicleOnGround
Function
isVehicleOnGround
Returns whether the vehicle stands on its wheels on the ground.
Syntax
bool isVehicleOnGround(vehicle element)Arguments
elementvehicle- The vehicle.
Returns
true when on the ground.
Example
local vehicle = createVehicle(411, 2000, -1690, 13.5)
outputDebugString(tostring(isVehicleOnGround(vehicle)))
Notes
Client. In a client script it reads the game every frame (wheel suspension; bike, boat, plane - whether it is airborne). A vehicle this player does not drive (parked or driven by someone else) has no physics on this client - then true. On the server it is script state - use the client version to check driving.
Always the default value. The server does not receive this information from the game yet, so the function returns true. To detect flight use e.g. the vertical speed from getElementVelocity.