Class DynamicGridObstacle Extends GraphModifier
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.
Make sure that any children colliders do not extend beyond the bounds of the collider attached to the GameObject that the DynamicGridObstacle component is attached to since this script only updates the graph around the bounds of the collider on the same GameObject.
This script works with both 2D colliders and normal 3D colliders.
Note
This script only works with GridGraph, PointGraph and LayerGridGraph
Public Methods
Update the graphs around this object.
Called right after all graphs have been scanned.
Public Variables
Time in seconds between bounding box checks.
The minimum change in world units along one of the axis of the bounding box of the collider to trigger a graph update.
Inherited Public Members
Called after graphs have been updated using GraphUpdateObjects.
Called before graphs are updated using GraphUpdateObjects.
Called at the end of the scanning procedure.
Called after cached graphs have been loaded.
Called right before graphs are going to be scanned.
Triggers an event for all active graph modifiers.
Private/Protected Members
Volume of a Bounds object.
Collider to get bounds information from.
2D Collider to get bounds information from
Revert graphs when disabled.
Adds this modifier to list of active modifiers.
Handle serialization backwards compatibility.
Bounds of the collider the last time the graphs were updated.
True if the collider was enabled last time the graphs were updated.
Rotation of the collider the last time the graphs were updated.
Handle serialization backwards compatibility.
Cached transform component.
Unique persistent ID for this component, used for serialization.
Maps persistent IDs to the component that uses it.