A* Pathfinding Project
3.1.4
The A* Pathfinding Project for Unity 3D
|
Base class for simple RVO colliders. More...
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< ObstacleVertex > | addedObstacles |
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. | |
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.
|
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 OnEnable | ( | ) |
Enabled the obstacle.
Do not override this function
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
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
|
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 |
Static or dynamic.
This determines if the obstacle can be updated by e.g moving the transform around in the scene.