A* Pathfinding Project
4.0.3
The A* Pathfinding Project for Unity 3D
|
Adds a navmesh as RVO obstacles. More...
Adds a navmesh as RVO obstacles.
Add this to a scene in which has a navmesh or grid based graph, when scanning (or loading from cache) the graph it will be added as RVO obstacles to the RVOSimulator (which must exist in the scene).
If you update a graph during runtime the obstacles need to be recalculated which has a performance penalty. This can be quite significant for larger graphs.
Public Member Functions | |
override void | OnGraphsPostUpdate () |
Called after graphs have been updated using GraphUpdateObjects. | |
override void | OnLatePostScan () |
Called at the end of the scanning procedure. | |
override void | OnPostCacheLoad () |
Called after cached graphs have been loaded. | |
void | RemoveObstacles () |
Removes all obstacles which have been added by this component. | |
Public Member Functions inherited from GraphModifier | |
virtual void | OnGraphsPreUpdate () |
Called before graphs are updated using GraphUpdateObjects. | |
virtual void | OnPostScan () |
Called right after all graphs have been scanned. | |
virtual void | OnPreScan () |
Called right before graphs are going to be scanned. | |
Public Attributes | |
float | wallHeight = 5 |
Height of the walls added for each obstacle edge. | |
Private Member Functions | |
void | AddGraphObstacles (Pathfinding.RVO.Simulator sim, GridGraph grid) |
void | AddGraphObstacles (Pathfinding.RVO.Simulator sim, INavmesh ng) |
Adds obstacles for a graph. | |
Static Private Member Functions | |
static void | CompressContour (Dictionary< int, int > outline, HashSet< int > hasInEdge, System.Action< List< int >, bool > results) |
static void | FindAllContours (GridGraph grid, System.Action< Vector3[], bool > callback, GridNodeBase[] nodes=null) |
Finds all contours of a collection of nodes in a grid graph. | |
Private Attributes | |
Simulator | lastSim |
Last simulator used. | |
readonly List< ObstacleVertex > | obstacles = new List<ObstacleVertex>() |
Obstacles currently added to the simulator. | |
Additional Inherited Members | |
Public Types inherited from GraphModifier | |
enum | EventType { PostScan = 1 << 0, PreScan = 1 << 1, LatePostScan = 1 << 2, PreUpdate = 1 << 3, PostUpdate = 1 << 4, PostCacheLoad = 1 << 5 } |
GraphModifier event type. More... | |
Static Public Member Functions inherited from GraphModifier | |
static void | FindAllModifiers () |
static void | TriggerEvent (GraphModifier.EventType type) |
Triggers an event for all active graph modifiers. | |
Protected Member Functions inherited from GraphModifier | |
override void | Awake () |
virtual void | OnDestroy () |
virtual void | OnDisable () |
Removes this modifier from list of active modifiers. | |
virtual void | OnEnable () |
Adds this modifier to list of active modifiers. | |
Static Protected Member Functions inherited from GraphModifier | |
static List< T > | GetModifiersOfType< T > () |
Protected Attributes inherited from GraphModifier | |
ulong | uniqueID |
Unique persistent ID for this component, used for serialization. | |
Static Protected Attributes inherited from GraphModifier | |
static Dictionary< ulong, GraphModifier > | usedIDs = new Dictionary<ulong, GraphModifier>() |
Maps persistent IDs to the component that uses it. | |
|
private |
|
private |
Adds obstacles for a graph.
|
staticprivate |
|
staticprivate |
Finds all contours of a collection of nodes in a grid graph.
In the image below you can see the contour of a graph.
In the image below you can see the contour of just a part of a grid graph (when the nodes parameter is supplied)
Contour of a hexagon graph
grid | The grid to find the contours of |
callback | The callback will be called once for every contour that is found, the first parameter is the vertices and the second parameter indicates if that contour is a cycle or if it is just a chain (chains can only occur when you explicitly specify some nodes to search |
nodes | Only these nodes will be searched. If this parameter is null then all nodes in the grid graph will be searched. |
|
virtual |
Called after graphs have been updated using GraphUpdateObjects.
Eventual flood filling has been done
Reimplemented from GraphModifier.
|
virtual |
Called at the end of the scanning procedure.
This is the absolute last thing done by Scan.
Reimplemented from GraphModifier.
|
virtual |
Called after cached graphs have been loaded.
When using cached startup, this event is analogous to OnLatePostScan and implementing scripts should do roughly the same thing for both events.
Reimplemented from GraphModifier.
void RemoveObstacles | ( | ) |
Removes all obstacles which have been added by this component.
|
private |
Last simulator used.
|
private |
Obstacles currently added to the simulator.
float wallHeight = 5 |
Height of the walls added for each obstacle edge.
If a graph contains overlapping regions (e.g multiple floor in a building) you should set this low enough so that edges on different levels do not interfere, but high enough so that agents cannot move over them by mistake.