A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
RVOObstacle Class Referenceabstract

Base class for simple RVO colliders. More...

+ Inheritance diagram for RVOObstacle:
+ Collaboration diagram for RVOObstacle:

Public Types

enum  ObstacleVertexWinding { KeepOut, KeepIn, Both }
 RVO Obstacle Modes. More...
 

Public Member Functions

void OnDisable ()
 Disables the obstacle.
 
void OnDrawGizmos ()
 Draws Gizmos.
 
void OnDrawGizmos (bool selected)
 Draws Gizmos.
 
void OnDrawGizmosSelected ()
 Draws Gizmos.
 
void OnEnable ()
 Enabled the obstacle.
 
void Start ()
 Creates obstacles.
 
void Update ()
 Updates obstacle if required.
 

Public Attributes

ObstacleVertexWinding obstacleMode
 Mode of the obstacle.
 

Protected Member Functions

void AddObstacle (Vector3[] vertices, float height)
 Adds an obstacle with the specified vertices.
 
abstract bool AreGizmosDirty ()
 Called in the editor.
 
abstract void CreateObstacles ()
 Create Obstacles.
 
void FindSimulator ()
 Finds a simulator in the scene.
 
virtual Matrix4x4 GetMatrix ()
 Get's the matrix to use for vertices.
 

Protected Attributes

Pathfinding.RVO.Simulator sim
 Reference to simulator.
 

Properties

abstract bool ExecuteInEditor [get]
 Enable executing in editor to draw gizmos.
 
abstract bool LocalCoordinates [get]
 If enabled, all coordinates are handled as local.
 
abstract bool StaticObstacle [get]
 Static or dynamic.
 

Private Member Functions

void AddObstacleInternal (Vector3[] vertices, float height)
 Adds an obstacle.
 
void WindCorrectly (Vector3[] vertices)
 Winds the vertices correctly.
 

Private Attributes

ObstacleVertexWinding _obstacleMode
 Last obstacle mode.
 
List< ObstacleVertexaddedObstacles
 All obstacles added.
 
bool gizmoDrawing = false
 Enabled if currently in OnDrawGizmos.
 
List< Vector3[]> gizmoVerts
 Vertices for gizmos.
 
Matrix4x4 prevUpdateMatrix
 Last matrix the obstacle was updated with.
 
List< Vector3[]> sourceObstacles
 Original vertices for the obstacles.
 

Detailed Description

Base class for simple RVO colliders.

This is a helper base class for RVO colliders. It provides automatic gizmos and helps with the winding order of the vertices as well as automatically updating the obstacle when moved.

Extend this class to create custom RVO obstacles.

See Also
writing-rvo-colliders
RVOSquareObstacle

Member Enumeration Documentation

RVO Obstacle Modes.

Determines winding order of obstacle vertices

Enumerator:
KeepOut 

Keeps agents from entering the obstacle.

KeepIn 

Keeps agents inside the obstacle.

Both 

Keeps agents from crossing the obstacle border in either direction.

Member Function Documentation

void AddObstacle ( Vector3[]  vertices,
float  height 
)
protected

Adds an obstacle with the specified vertices.

The vertices array might be changed by this function.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AddObstacleInternal ( Vector3[]  vertices,
float  height 
)
private

Adds an obstacle.

Winding is assumed to be correct and very little error checking is done.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

abstract bool AreGizmosDirty ( )
protectedpure virtual

Called in the editor.

This function should return true if any variables which can change the shape or position of the obstacle has changed since the last call to this function. Take a look at the RVOSquareObstacle for an example.

Implemented in RVOSquareObstacle.

+ Here is the caller graph for this function:

abstract void CreateObstacles ( )
protectedpure virtual

Create Obstacles.

Override this and add logic for creating obstacles. You should not use the simulator's function calls directly.

See Also
AddObstacle

Implemented in RVOSquareObstacle.

+ Here is the caller graph for this function:

void FindSimulator ( )
protected

Finds a simulator in the scene.

Saves found simulator in sim.

Exceptions
System.InvalidOperationExceptionWhen no RVOSimulator could be found.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual Matrix4x4 GetMatrix ( )
protectedvirtual

Get's the matrix to use for vertices.

Can be overriden for custom matrices.

Returns
transform.localToWorldMatrix if LocalCoordinates is true, otherwise Matrix4x4.identity

+ Here is the caller graph for this function:

void OnDisable ( )

Disables the obstacle.

Do not override this function

+ Here is the call graph for this function:

void OnEnable ( )

Enabled the obstacle.

Do not override this function

+ Here is the call graph for this function:

void Update ( )

Updates obstacle if required.

Checks for if the obstacle should be updated (e.g if it has moved)

+ Here is the call graph for this function:

void WindCorrectly ( Vector3[]  vertices)
private

Winds the vertices correctly.

Winding order is determined from obstacleMode.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

ObstacleVertexWinding _obstacleMode
private

Last obstacle mode.

Used to check if the gizmos should be updated

ObstacleVertexWinding obstacleMode

Mode of the obstacle.

Determines winding order of the vertices

Matrix4x4 prevUpdateMatrix
private

Last matrix the obstacle was updated with.

Used to check if the obstacle should be updated

Property Documentation

abstract bool ExecuteInEditor
getprotected

Enable executing in editor to draw gizmos.

If enabled, the CreateObstacles function will be executed in the editor as well in order to draw gizmos.

abstract bool StaticObstacle
getprotected

Static or dynamic.

This determines if the obstacle can be updated by e.g moving the transform around in the scene.


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