Public
Abstract
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.
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 Methods
void
OnDisable
()
Disables the obstacle.
Do not override this function
void
OnDrawGizmos
()
Draws Gizmos.
void
OnDrawGizmos
(
)
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)
Public Variables
RVOLayer
layer = RVOLayer.DefaultObstacle
Mode of the obstacle.
Determines winding order of the vertices
Public Enums
ObstacleVertexWinding
KeepOut |
Keeps agents from entering the obstacle.
|
KeepIn |
Keeps agents inside the obstacle.
|
RVO Obstacle Modes.
Determines winding order of obstacle vertices
Private/Protected Members
void
AddObstacle
(
Vector3[] | vertices | |
float | height | |
)
Adds an obstacle with the specified vertices.
The vertices array might be changed by this function.
void
AddObstacleInternal
(
Vector3[] | vertices | |
float | height | |
)
Adds an obstacle.
Winding is assumed to be correct and very little error checking is done.
bool
AreGizmosDirty
()
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.
void
CreateObstacles
()
Create Obstacles.
Override this and add logic for creating obstacles. You should not use the simulator's function calls directly.
bool
ExecuteInEditor
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.
void
FindSimulator
()
Finds a simulator in the scene.
Saves found simulator in sim.
Get's the matrix to use for vertices.
Can be overriden for custom matrices.
Return
transform.localToWorldMatrix if LocalCoordinates is true, otherwise Matrix4x4.identity
bool
LocalCoordinates
If enabled, all coordinates are handled as local.
int
OnUpgradeSerializedData
(
int | version | |
bool | unityThread | |
)
Handle serialization backwards compatibility.
void
Reset
()
Handle serialization backwards compatibility.
bool
StaticObstacle
Static or dynamic.
This determines if the obstacle can be updated by e.g moving the transform around in the scene.
void
UpgradeSerializedData
(
)
void
WindCorrectly
(
)
Winds the vertices correctly.
Winding order is determined from obstacleMode.
Last obstacle mode.
Used to check if the gizmos should be updated
bool
gizmoDrawing = false
Enabled if currently in OnDrawGizmos.
List<Vector3[]>
gizmoVerts
Vertices for gizmos.
Last matrix the obstacle was updated with.
Used to check if the obstacle should be updated
List<Vector3[]>
sourceObstacles
Original vertices for the obstacles.