onVehicleMove

Description

This is called when a vehicle moves.

NameDescription
vehicleThe pointer of the vehicle
oldXOld X coordinate
oldYOld Y coordinate
oldZOld Z coordinate
newXNew X coordinate
newYNew Y coordinate
newZNew Z coordinate

Example

This example will move the vehicle back to point (0, 0, 0) if they move too far away from it.

function GetPointDistanceToPoint(x1, y1, z1, x2, y2, z2)
{
return Vector(x1-x2, y1-y2, z1-z2).Length();
}
function onVehicleMove(vehicle, oldX, oldY, oldZ, newX, newY, newZ) {
if(GetPointDistanceToPoint(0.0, 0.0, 0.0, newX, newY, newZ) > 50.0) {
vehicle.Pos = Vector(0.0, 0.0, 0.0);
}
}