generateDirectionsToCoord
GENERATE_DIRECTIONS_TO_COORD0xF90125F1F79ECDF8The GTA V native GENERATE_DIRECTIONS_TO_COORD of the PATHFIND namespace, as LS:MP client scripts call it: the global function generateDirectionsToCoord, in JavaScript and in Lua.
generateDirectionsToCoord(x: number, y: number, z: number, p3: boolean): [
result: number,
direction: number,
p5: number,
distToNxJunction: number
]generateDirectionsToCoord(
x: number,
y: number,
z: number,
p3: boolean
): integer, integer, number, numberUsage
const [result, direction, p5, distToNxJunction] =
generateDirectionsToCoord(x, y, z, p3);local result, direction, p5, distToNxJunction =
generateDirectionsToCoord(x, y, z, p3)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
const [result, direction, p5, distToNxJunction] = generateDirectionsToCoord(pos, p3);local result, direction, p5, distToNxJunction = generateDirectionsToCoord(pos, p3)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
x | float | number | number |
y | float | number | number |
z | float | number | number |
p3 | BOOL | boolean | boolean |
Returns
4 values, in this order: an array in JavaScript, multiple return values in Lua.
| # | Value | Type | JavaScript | Lua | Description |
|---|---|---|---|---|---|
| 1 | result | int | number | integer | The native’s own return value. |
| 2 | direction | int | number | integer | output |
| 3 | p5 | float | number | number | output |
| 4 | distToNxJunction | float | number | number | output |
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
p3 is 0 in the only game script occurrence (trevor3) but 1 doesn't seem to make a difference
distToNxJunction seems to be the distance in metres * 10.0f
direction:
0 = This happens randomly during the drive for seemingly no reason but if you consider that this native is only used in trevor3, it seems to mean "Next frame, stop whatever's being said and tell the player the direction."
1 = Route is being calculated or the player is going in the wrong direction
2 = Please Proceed the Highlighted Route
3 = In (distToNxJunction) Turn Left
4 = In (distToNxJunction) Turn Right
5 = In (distToNxJunction) Keep Straight
6 = In (distToNxJunction) Turn Sharply To The Left
7 = In (distToNxJunction) Turn Sharply To The Right
8 = Route is being recalculated or the navmesh is confusing. This happens randomly during the drive but consistently at {2044.0358, 2996.6116, 44.9717} if you face towards the bar and the route needs you to turn right. In that particular case, it could be a bug with how the turn appears to be 270 deg. CCW instead of "right." Either way, this seems to be the engine saying "I don't know the route right now."
return value set to 0 always
Reference
- Namespace
- Pathfinding PATHFIND
- In the game
int GENERATE_DIRECTIONS_TO_COORD(float x, float y, float z, BOOL p3, int* direction, float* p5, float* distToNxJunction)- Hash
0xF90125F1F79ECDF8