onVehicleMove
Description
This is called when a vehicle moves.
| Name | Description |
|---|---|
| vehicle | The pointer of the vehicle |
| oldX | Old X coordinate |
| oldY | Old Y coordinate |
| oldZ | Old Z coordinate |
| newX | New X coordinate |
| newY | New Y coordinate |
| newZ | New 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); }}