A* Pathfinding Project  3.0.9
The A* Pathfinding Project for Unity
DynamicGridObstacle Class Reference

Attach this script to any obstacle with a collider to enable dynamic updates of the graphs around it. More...

List of all members.

Public Member Functions

void OnDestroy ()  Revert graphs when destroyed.
void DoUpdateGraphs ()  
void DoUpdateGraphs2 ()  
float BoundsVolume (Bounds b)  Returns the volume of a Bounds object.

Public Variables

float updateError = 1  The minimum change along one of the axis of the bounding box of collider to trigger a graph update.
float checkTime = 0.2F  Time in seconds between bounding box checks.
bool simple = false  Does not use physics to rasterize the object to the grid.

Private Member Functions

void Start ()  Use this for initialization.
IEnumerator UpdateGraphs ()  Coroutine which checks for changes in the collider's bounding box.

Private Variables

Collider col  
Bounds prevBounds  
bool isWaitingForUpdate = false  

Detailed Description

Attach this script to any obstacle with a collider to enable dynamic updates of the graphs around it.

When the object has moved a certain distance (or actually when it's bounding box has changed by a certain amount) defined by updateError it will call AstarPath::UpdateGraphs and update the graph around it.

Note:
This will not work very good when using erosion on the grid since erosion is done in a post-processing step after scanning and is very difficult to update without rescanning the whole grid.
This script does only work with GridGraph and ListGraph
See also:
AstarPath::UpdateGraphs

Member Function Documentation

float BoundsVolume ( Bounds  b)

Returns the volume of a Bounds object.

X*Y*Z

void OnDestroy ( )

Revert graphs when destroyed.

When the DynamicObstacle is destroyed, a last graph update should be done to revert nodes to their original state

void Start ( ) [private]

Use this for initialization.

IEnumerator UpdateGraphs ( ) [private]

Coroutine which checks for changes in the collider's bounding box.


Member Data Documentation

float checkTime = 0.2F

Time in seconds between bounding box checks.

bool simple = false

Does not use physics to rasterize the object to the grid.

Use only if there are no static obstacles in the grid and the object is axis aligned

float updateError = 1

The minimum change along one of the axis of the bounding box of collider to trigger a graph update.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Properties