Skip to main content

Vehicle

Vehicle game instance APIs. To use these, you must first have a reference to a Vehicle, which you can get from a NetVehicle using the :GI() method.

-- Get a NetVehicle first, then get its game instance
local netVehicle = -- obtained from world or player
local vehicle = netVehicle:GI()

Class Instance Methods

Inherited Methods

From GameObject:

GameObject:GetPosition(): vec3

Returns the position of the game object.

GameObject:GetRotation(): quat

Returns the rotation of the game object.

GameObject:GetEulerRotation(): vec3

Returns the euler rotation of the game object.

From Damageable:

Damageable:GetHP(): number

Returns the health of the damageable.

Class Methods

Vehicle:GO(): GameObject

Returns the GameObject (GO) of the vehicle, used to modify transform.

Vehicle:GetVelocity(): vec3

Gets the vector3 velocity of the vehicle.

Vehicle:GetNumberOfWheelsOnGround(): number

Returns the number of wheels of the vehicle that are currently touching the ground.