A* Pathfinding Project  4.3.5
The A* Pathfinding Project for Unity 3D
RVONavmesh Class Reference

Adds a navmesh as RVO obstacles. More...

Detailed Description

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).

Warning
You should only have a single instance of this script in the scene, otherwise it will add duplicate obstacles and thereby increasing the CPU usage.

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.

In the screenshot the generated obstacles are visible in red.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here

Public Member Functions

override void OnGraphsPostUpdate ()
 Called after graphs have been updated using GraphUpdateObjects. More...
 
override void OnLatePostScan ()
 Called at the end of the scanning procedure. More...
 
override void OnPostCacheLoad ()
 Called after cached graphs have been loaded. More...
 
void RemoveObstacles ()
 Removes all obstacles which have been added by this component. More...
 
- Public Member Functions inherited from GraphModifier
virtual void OnGraphsPreUpdate ()
 Called before graphs are updated using GraphUpdateObjects. More...
 
virtual void OnPostScan ()
 Called right after all graphs have been scanned. More...
 
virtual void OnPreScan ()
 Called right before graphs are going to be scanned. More...
 

Public Attributes

float wallHeight = 5
 Height of the walls added for each obstacle edge. More...
 

Protected Member Functions

override void OnDisable ()
 Removes this modifier from list of active modifiers. More...
 
- Protected Member Functions inherited from GraphModifier
override void Awake ()
 
virtual void OnDestroy ()
 
virtual void OnEnable ()
 Adds this modifier to list of active modifiers. More...
 
override void Reset ()
 Handle serialization backwards compatibility. More...
 
- Protected Member Functions inherited from VersionedMonoBehaviour
virtual int OnUpgradeSerializedData (int version, bool unityThread)
 Handle serialization backwards compatibility. More...
 

Private Member Functions

void AddGraphObstacles (Pathfinding.RVO.ISimulator sim, GridGraph grid)
 Adds obstacles for a grid graph. More...
 
void AddGraphObstacles (Pathfinding.RVO.ISimulator simulator, INavmesh navmesh)
 Adds obstacles for a navmesh/recast graph. More...
 

Private Attributes

ISimulator lastSim
 Last simulator used. More...
 
readonly List< ObstacleVertexobstacles = new List<ObstacleVertex>()
 Obstacles currently added to the simulator. More...
 

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. More...
 
- 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. More...
 
- Static Protected Attributes inherited from GraphModifier
static Dictionary< ulong, GraphModifierusedIDs = new Dictionary<ulong, GraphModifier>()
 Maps persistent IDs to the component that uses it. More...
 
- Properties inherited from VersionedMonoBehaviour
int Util.IEntityIndex. EntityIndex [get, set]
 Internal entity index used by #BurstBatchHelper. More...
 
- Properties inherited from IEntityIndex
int EntityIndex [get, set]
 

Member Function Documentation

◆ AddGraphObstacles() [1/2]

void AddGraphObstacles ( Pathfinding.RVO.ISimulator  sim,
GridGraph  grid 
)
private

Adds obstacles for a grid graph.

◆ AddGraphObstacles() [2/2]

void AddGraphObstacles ( Pathfinding.RVO.ISimulator  simulator,
INavmesh  navmesh 
)
private

Adds obstacles for a navmesh/recast graph.

◆ OnDisable()

override void OnDisable ( )
protectedvirtual

Removes this modifier from list of active modifiers.

Reimplemented from GraphModifier.

◆ OnGraphsPostUpdate()

override void OnGraphsPostUpdate ( )
virtual

Called after graphs have been updated using GraphUpdateObjects.

Eventual flood filling has been done

Reimplemented from GraphModifier.

◆ OnLatePostScan()

override void OnLatePostScan ( )
virtual

Called at the end of the scanning procedure.

This is the absolute last thing done by Scan.

Reimplemented from GraphModifier.

◆ OnPostCacheLoad()

override void OnPostCacheLoad ( )
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.

◆ RemoveObstacles()

void RemoveObstacles ( )

Removes all obstacles which have been added by this component.

Member Data Documentation

◆ lastSim

ISimulator lastSim
private

Last simulator used.

◆ obstacles

readonly List<ObstacleVertex> obstacles = new List<ObstacleVertex>()
private

Obstacles currently added to the simulator.

◆ wallHeight

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.


The documentation for this class was generated from the following file: