A* Pathfinding Project
4.0.7
The A* Pathfinding Project for Unity 3D
|
Simplifies a path using raycasting. More...
Simplifies a path using raycasting.
This modifier will try to remove as many nodes as possible from the path using raycasting (linecasting) to validate the node removal. You can use either graph raycasting or Physics.Raycast. When using graph raycasting, the graph will be traversed and checked for obstacles. When physics raycasting is used, the Unity physics system will be asked if there are any colliders which intersect the line that is currently being checked.
Public Member Functions | |
override void | Apply (Path p) |
Main Post-Processing function. | |
bool | ValidateLine (GraphNode n1, GraphNode n2, Vector3 v1, Vector3 v2) |
Check if a straight path between v1 and v2 is valid. | |
Public Member Functions inherited from MonoModifier | |
virtual void | OnDestroy () |
void | OnDisable () |
void | OnEnable () |
virtual void | PreProcess (Path p) |
Public Member Functions inherited from IPathModifier | |
void | Apply (Path p) |
void | PreProcess (Path p) |
Public Attributes | |
int | iterations = 2 |
How many iterations to try to simplify the path. | |
LayerMask | mask = -1 |
Layer mask used for physics raycasting. | |
Vector3 | raycastOffset = Vector3.zero |
Offset from the original positions to perform the raycast. | |
bool | subdivideEveryIter |
Subdivides the path every iteration to be able to find shorter paths. | |
bool | thickRaycast |
Checks around the line between two points, not just the exact line. | |
float | thickRaycastRadius |
Distance from the ray which will be checked for colliders. | |
bool | useGraphRaycasting |
Use raycasting on the graphs. | |
bool | useRaycasting = true |
Use Physics.Raycast to simplify the path. | |
Public Attributes inherited from MonoModifier | |
Seeker | seeker |
Properties | |
override int | Order [get] |
Properties inherited from MonoModifier | |
abstract int | Order [get] |
Modifiers will be executed from lower order to higher order. | |
Properties inherited from IPathModifier | |
int | Order [get] |
Static Private Member Functions | |
static void | Subdivide (List< Vector3 > points) |
Divides each segment in the list into 3 segments. | |
Additional Inherited Members | |
Protected Member Functions inherited from MonoModifier | |
override void | Awake () |
Alerts the Seeker that this modifier exists. | |
|
virtual |
Main Post-Processing function.
Implements MonoModifier.
|
staticprivate |
Divides each segment in the list into 3 segments.
Check if a straight path between v1 and v2 is valid.
int iterations = 2 |
How many iterations to try to simplify the path.
If the path is changed in one iteration, the next iteration may find more simplification oppourtunities
LayerMask mask = -1 |
Layer mask used for physics raycasting.
Vector3 raycastOffset = Vector3.zero |
Offset from the original positions to perform the raycast.
Can be useful to avoid the raycast intersecting the ground or similar things you do not want to it intersect
bool subdivideEveryIter |
Subdivides the path every iteration to be able to find shorter paths.
bool thickRaycast |
Checks around the line between two points, not just the exact line.
Make sure the ground is either too far below or is not inside the mask since otherwise the raycast might always hit the ground
float thickRaycastRadius |
Distance from the ray which will be checked for colliders.
bool useGraphRaycasting |
Use raycasting on the graphs.
Only currently works with GridGraph and NavmeshGraph and RecastGraph.
bool useRaycasting = true |
Use Physics.Raycast to simplify the path.
|
get |