Modules/Pathfinding/findShortestPathBetween

From Multi Theft Auto: Wiki
Revision as of 17:48, 3 February 2022 by Tracer (talk | contribs) (Created page with "<pageclass class="#AA7592" subcaption="Pathfinding Module"></pageclass> __NOTOC__ {{ModuleFunction|Pathfinding}} This function finds the shortest path between 2 points in the world. ==Syntax== <syntaxhighlight lang="c++"> bool findShortestPathBetween(int graphId, float startX, float startY, float startZ, float endX, float endY, float endZ, function callback) </syntaxhighlight> ===Required arguments=== * '''graphId:''' The id of the graph * '''startX, startY, startZ'''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


This function is provided by the external module Pathfinding. You must install this module to use this function.

This function finds the shortest path between 2 points in the world.

Syntax

bool findShortestPathBetween(int graphId, float startX, float startY, float startZ, float endX, float endY, float endZ, function callback)

Required arguments

  • graphId: The id of the graph
  • startX, startY, startZ: The start position
  • endX, endY, endZ: The end position
  • callback: The callback function (parameters: table nodes)

Returns

Returns true if the route calculation has been scheduled successfully, false otherwise.

Example

See Also

Functions