SetVehicleTurnVelocity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 20: Line 20:


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns ''true'' if it was succesful, ''false'' otherwise.


==Example==
==Example==

Revision as of 17:07, 27 August 2007

Dialog-information.png This article needs checking.

Reason(s): We need a min-max values allowed or a recommended min-max/relevant range?

--Ransom 02:46, 11 April 2007 (CDT)


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

Syntax

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

Required Arguments

  • theVehicle: 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 = getPlayerOccupiedVehicle ( thePlayer )
    if playerVehicle ~= false then
        -- If so, give it a spin
        setVehicleTurnVelocity ( playerVehicle, 0, 0, 20 )
    end
end
addEventHandler ( "onColShapeHit", getRootElement ( ), onColShapeHit )

See Also