SetVehicleAngularVelocity

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
SetVehicleAngularVelocity

Type: Function
Context: Server
Introduced: v1.0

Description

Set the vehicle's angular (rotational) velocity.

Syntax

SetVehicleAngularVelocity(vehicle, x, y, z [, reset])

Parameters

  • vehicle
    The vehicle identifier.
  • x
    The X axis velocity
  • y
    The Y axis velocity
  • z
    The Z axis velocity
  • reset (optional)
    true to reset the angular velocity, default: false

Return Value

  • This function returns true.

Example

function VehicleVelocityReset(player)
	local vehicle = GetPlayerVehicle(player)
	if (vehicle ~= 0) then
		SetVehicleLinearVelocity(vehicle, 0.0, 0.0, 0.0, true)
		SetVehicleAngularVelocity(vehicle, 0.0, 0.0, 0.0, true)
		local rx, ry, rz = GetVehicleRotation(vehicle)
		-- Reset pitch and roll, leave yaw alone
		SetVehicleRotation(vehicle, 0.0, ry, 0.0)
	end
end
AddRemoteEvent("VehicleVelocityReset", VehicleVelocityReset)

See also