A* Pathfinding Project
4.1.9
The A* Pathfinding Project for Unity 3D
|
Base class for simple RVO colliders. More...
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.
Public Types | |
enum | ObstacleVertexWinding { KeepOut, KeepIn } |
RVO Obstacle Modes. More... | |
Public Member Functions | |
void | OnDisable () |
Disables the obstacle. More... | |
void | OnDrawGizmos () |
Draws Gizmos. More... | |
void | OnDrawGizmos (bool selected) |
Draws Gizmos. More... | |
void | OnDrawGizmosSelected () |
Draws Gizmos. More... | |
void | OnEnable () |
Enabled the obstacle. More... | |
void | Start () |
Creates obstacles. More... | |
void | Update () |
Updates obstacle if required. More... | |
Public Attributes | |
RVOLayer | layer = RVOLayer.DefaultObstacle |
ObstacleVertexWinding | obstacleMode |
Mode of the obstacle. More... | |
Protected Member Functions | |
void | AddObstacle (Vector3[] vertices, float height) |
Adds an obstacle with the specified vertices. More... | |
abstract bool | AreGizmosDirty () |
Called in the editor. More... | |
abstract void | CreateObstacles () |
Create Obstacles. More... | |
void | FindSimulator () |
Finds a simulator in the scene. More... | |
virtual Matrix4x4 | GetMatrix () |
Get's the matrix to use for vertices. More... | |
Protected Member Functions inherited from VersionedMonoBehaviour | |
virtual void | Awake () |
virtual int | OnUpgradeSerializedData (int version, bool unityThread) |
Handle serialization backwards compatibility. More... | |
Protected Attributes | |
Pathfinding.RVO.Simulator | sim |
Reference to simulator. More... | |
Properties | |
abstract bool | ExecuteInEditor [get] |
Enable executing in editor to draw gizmos. More... | |
abstract float | Height [get] |
abstract bool | LocalCoordinates [get] |
If enabled, all coordinates are handled as local. More... | |
abstract bool | StaticObstacle [get] |
Static or dynamic. More... | |
Private Member Functions | |
void | AddObstacleInternal (Vector3[] vertices, float height) |
Adds an obstacle. More... | |
void | WindCorrectly (Vector3[] vertices) |
Winds the vertices correctly. More... | |
Private Attributes | |
ObstacleVertexWinding | _obstacleMode |
Last obstacle mode. More... | |
List< ObstacleVertex > | addedObstacles |
All obstacles added. More... | |
bool | gizmoDrawing = false |
Enabled if currently in OnDrawGizmos. More... | |
List< Vector3[]> | gizmoVerts |
Vertices for gizmos. More... | |
Matrix4x4 | prevUpdateMatrix |
Last matrix the obstacle was updated with. More... | |
List< Vector3[]> | sourceObstacles |
Original vertices for the obstacles. More... | |
|
strong |
RVO Obstacle Modes.
Determines winding order of obstacle vertices
Enumerator | |
---|---|
KeepOut | Keeps agents from entering the obstacle. |
KeepIn | Keeps agents inside the obstacle. |
|
protected |
Adds an obstacle with the specified vertices.
The vertices array might be changed by this function.
|
private |
Adds an obstacle.
Winding is assumed to be correct and very little error checking is done.
|
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.
|
protectedpure virtual |
Create Obstacles.
Override this and add logic for creating obstacles. You should not use the simulator's function calls directly.
Implemented in RVOSquareObstacle.
|
protected |
Finds a simulator in the scene.
Saves found simulator in sim.
System.InvalidOperationException | When no RVOSimulator could be found. |
|
protectedvirtual |
Get's the matrix to use for vertices.
Can be overriden for custom matrices.
void OnDisable | ( | ) |
Disables the obstacle.
Do not override this function
void OnDrawGizmos | ( | ) |
Draws Gizmos.
void OnDrawGizmos | ( | bool | selected | ) |
Draws Gizmos.
void OnDrawGizmosSelected | ( | ) |
Draws Gizmos.
void OnEnable | ( | ) |
Enabled the obstacle.
Do not override this function
void Start | ( | ) |
Creates obstacles.
void Update | ( | ) |
Updates obstacle if required.
Checks for if the obstacle should be updated (e.g if it has moved)
|
private |
Winds the vertices correctly.
Winding order is determined from obstacleMode.
|
private |
Last obstacle mode.
Used to check if the gizmos should be updated
|
private |
All obstacles added.
|
private |
Enabled if currently in OnDrawGizmos.
|
private |
Vertices for gizmos.
RVOLayer layer = RVOLayer.DefaultObstacle |
ObstacleVertexWinding obstacleMode |
Mode of the obstacle.
Determines winding order of the vertices
|
private |
Last matrix the obstacle was updated with.
Used to check if the obstacle should be updated
|
protected |
Reference to simulator.
|
private |
Original vertices for the obstacles.
|
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.
|
getprotected |
|
getprotected |
If enabled, all coordinates are handled as local.
|
getprotected |
Static or dynamic.
This determines if the obstacle can be updated by e.g moving the transform around in the scene.