SixL client API / game/pathfind / GamePathfindMp

Interface: GamePathfindMp

The road and navigation functions: road nodes, the GPS route of the blip and the navigation mesh.

Remarks

Getters are asynchronous: they return a Promise. A vehicle node is an id of a road node of the map.

Example

const onRoad = await mp.game.pathfind.isPointOnRoad(0, 0, 70);

Methods

addNavmeshRequiredRegion()

addNavmeshRequiredRegion(x, y, radius): void

Adds a circular area that the navigation mesh must load, so that vehicles and peds can path inside it.

Parameters

x

number

The centre's X coordinate, in metres.

y

number

The centre's Y coordinate, in metres.

radius

number

The area's radius, in metres.

Returns

void

Example

mp.game.pathfind.addNavmeshRequiredRegion(0, 0, 100);

areAllNavmeshRegionsLoaded()

areAllNavmeshRegionsLoaded(): Promise<boolean>

Whether all navigation mesh regions the game needs are loaded.

Returns

Promise<boolean>

A Promise of true when every required region is loaded.

Example

const ready = await mp.game.pathfind.areAllNavmeshRegionsLoaded();

doesNavmeshBlockingObjectExist()

doesNavmeshBlockingObjectExist(id): Promise<boolean>

Whether a navigation mesh blocking object exists.

Parameters

id

number

The blocking object's id.

Returns

Promise<boolean>

A Promise of true when the object exists.

Example

const exists = await mp.game.pathfind.doesNavmeshBlockingObjectExist(id);

getGpsBlipRouteFound()

getGpsBlipRouteFound(): Promise<boolean>

Whether the game has found a GPS route to the map blip.

Returns

Promise<boolean>

A Promise of true when a route is found.

Example

const found = await mp.game.pathfind.getGpsBlipRouteFound();

getGpsBlipRouteLength()

getGpsBlipRouteLength(): Promise<number>

The length of the GPS route that the map blip shows.

Returns

Promise<number>

A Promise of the route length as a number (the game's own units).

Example

const length = await mp.game.pathfind.getGpsBlipRouteLength();

getIsSlowRoadFlag()

getIsSlowRoadFlag(nodeID): Promise<boolean>

The same value as getVehicleNodeIsSwitchedOff, under RAGE MP's name for it.

Parameters

nodeID

number

The vehicle node id.

Returns

Promise<boolean>

A Promise of true when the node is switched off.

Example

const slow = await mp.game.pathfind.getIsSlowRoadFlag(nodeId);

getSupportsGpsRouteFlag()

getSupportsGpsRouteFlag(nodeID): Promise<boolean>

The same value as getVehicleNodeIsGpsAllowed, under RAGE MP's name for it.

Parameters

nodeID

number

The vehicle node id.

Returns

Promise<boolean>

A Promise of true when a GPS route may use the node.

Example

const allowed = await mp.game.pathfind.getSupportsGpsRouteFlag(nodeId);

getVehicleNodeIsGpsAllowed()

getVehicleNodeIsGpsAllowed(nodeID): Promise<boolean>

Whether a road node allows a GPS route through it.

Parameters

nodeID

number

The vehicle node id.

Returns

Promise<boolean>

A Promise of true when a GPS route may use the node.

Example

const allowed = await mp.game.pathfind.getVehicleNodeIsGpsAllowed(nodeId);

getVehicleNodeIsSwitchedOff()

getVehicleNodeIsSwitchedOff(nodeID): Promise<boolean>

Whether a road node is switched off (closed to traffic).

Parameters

nodeID

number

The vehicle node id.

Returns

Promise<boolean>

A Promise of true when the node is switched off.

Example

const off = await mp.game.pathfind.getVehicleNodeIsSwitchedOff(nodeId);

getVehicleNodePosition()

getVehicleNodePosition(nodeId): Promise<IVector3>

The position of a road node.

Parameters

nodeId

number

The vehicle node id.

Returns

Promise<IVector3>

A Promise of the node's position as { x, y, z } in metres.

Example

const { x, y, z } = await mp.game.pathfind.getVehicleNodePosition(nodeId);

isPointOnRoad()

isPointOnRoad(x, y, z, vehicle?): Promise<boolean>

Whether a point lies on a road.

Parameters

x

number

The X coordinate, in metres.

y

number

The Y coordinate, in metres.

z

number

The Z coordinate, in metres.

vehicle?

number | { handle: number; }

The vehicle whose road type is considered, or its handle. Optional: without it the road is checked for any vehicle.

Returns

Promise<boolean>

A Promise of true when the point is on a road.

Example

const onRoad = await mp.game.pathfind.isPointOnRoad(0, 0, 70);

isVehicleNodeIdValid()

isVehicleNodeIdValid(vehicleNodeId): Promise<boolean>

Whether a vehicle node id is a valid road node of the map.

Parameters

vehicleNodeId

number

The vehicle node id.

Returns

Promise<boolean>

A Promise of true when the id is a valid node.

Example

const valid = await mp.game.pathfind.isVehicleNodeIdValid(1);

removeNavmeshBlockingObject()

removeNavmeshBlockingObject(id): void

Removes a navigation mesh blocking object.

Parameters

id

number

The blocking object's id.

Returns

void

Example

mp.game.pathfind.removeNavmeshBlockingObject(id);