A* Pathfinding Project
4.1.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) 
Called for each path that the Seeker calculates after the calculation has finished. More...  
bool  ValidateLine (GraphNode n1, GraphNode n2, Vector3 v1, Vector3 v2) 
Check if a straight path between v1 and v2 is valid. More...  
Public Member Functions inherited from MonoModifier  
virtual void  PreProcess (Path path) 
Public Attributes  
int  iterations = 2 
How many iterations to try to simplify the path. More...  
LayerMask  mask = 1 
Layer mask used for physics raycasting. More...  
Vector3  raycastOffset = Vector3.zero 
Offset from the original positions to perform the raycast. More...  
bool  subdivideEveryIter 
Subdivides the path every iteration to be able to find shorter paths. More...  
bool  thickRaycast 
Checks around the line between two points, not just the exact line. More...  
float  thickRaycastRadius 
Distance from the ray which will be checked for colliders. More...  
bool  use2DPhysics 
Check for intersections with 2D colliders instead of 3D colliders. More...  
bool  useGraphRaycasting 
Use raycasting on the graphs. More...  
bool  useRaycasting = true 
Use Physics.Raycast to simplify the path. More...  
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. More...  
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. More...  
Additional Inherited Members  
Protected Member Functions inherited from MonoModifier  
virtual void  OnDisable () 
virtual void  OnEnable () 
Alerts the Seeker that this modifier exists. More...  
Protected Member Functions inherited from VersionedMonoBehaviour  
virtual void  Awake () 
virtual int  OnUpgradeSerializedData (int version, bool unityThread) 
Handle serialization backwards compatibility. More...  

virtual 
Called for each path that the Seeker calculates after the calculation has finished.
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 use2DPhysics 
Check for intersections with 2D colliders instead of 3D colliders.
Useful for 2D games.
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 