A* Pathfinding Project  3.7.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
Using Modifiers

Modifiers are small scripts which can hook in to the Seeker and pre and or post process the path before it is returned to the caller.


This can for example be a Raycast Modfier which removes unecessary nodes in a path to make it shorter but still valid.
Or a Smooth Modifier which subdivides the path and smooths it to make it more aesthetically appealing.
Modifiers are ordered by priority, modifiers with higher priority will execute before those with a lower priority.
The order of execution can be a bit tricky in some cases, for example if one is using the StartEndPoint modifier and Simple Smooth Modifier, which one should have the higher priority?
In this case StartEndPoint should have the higher priority because otherwise, the path would be smoothed first, and then the first and last points would be modified and that would look bad.
Each modifier has an input and an output, they are there to simplify the task of setting the correct priority values. The Seeker component will show a warning if one modifier's output cannot be converted to the next one's input.

See Also
Pathfinding::ModifierData

Simple Smooth Modifier

The simple smooth modifier is a modifier to smooth the path. It can do that either by just subdividing it and moving the vertices closer to each other or use splines, namely the Bezier curve.
Below are two images showing a path with the smooth modifier turned off first and then on. Note that the smoothed path cuts the corners a bit, this can be a problem with the smooth modifier since it does not take world geometry into account when smoothing.

smoothModifier_off.png
For variable documentation, look at the Simple Smooth Modifier documentation

Funnel Modifier

The funnel modifier is a modifier for simplifying paths on navmeshes or grid graphs is a fast and exact way.
As the name implies it applies the funnel algorithm to the path.
This will return the shortest path inside the path corridor the pathfinder calculated

funnelModifier_on.png

For a full list of modifiers, see Using Modifiers

See Also
Writing Modifiers