SetVehicleTurnVelocity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(OOP)
m (Added future deprecation hint)
Line 2: Line 2:
{{Server client function}}
{{Server client function}}
Sets the angular velocity of a vehicle. Basically applies a spin to it.
Sets the angular velocity of a vehicle. Basically applies a spin to it.
{{Deprecated feature|3.0156|1.5.6|This function will be deprecated in '''1.5.6''', use [[setElementAngularVelocity]] in the future.}}


==Syntax==  
==Syntax==  

Revision as of 22:32, 27 August 2018

Sets the angular velocity of a vehicle. Basically applies a spin to it.

Syntax

bool setVehicleTurnVelocity ( vehicle theVehicle, float rx, float ry, float rz )           

OOP Syntax Help! I don't understand this!

Method: vehicle:setTurnVelocity(...)
Variable: .turnVelocity
Counterpart: getVehicleTurnVelocity


Required Arguments

  • theVehicle: The vehicle to apply the spin to.
  • rx: velocity around the X axis
  • ry: velocity around the Y axis
  • rz: velocity around the Z axis

Returns

Returns true if it was succesful, false otherwise.

Example

function onColShapeHit ( thePlayer, matchingDimension )
    -- When a player hits the collision shape, check if he's in a vehicle
    local playerVehicle = getPedOccupiedVehicle ( thePlayer )
    if playerVehicle ~= false then
        -- If so, give it a spin
        setVehicleTurnVelocity ( playerVehicle, 0, 0, 20 )
    end
end
addEventHandler ( "onColShapeHit", getRootElement ( ), onColShapeHit )

See Also