A* Pathfinding Project  4.1.6
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.

Modifiers are used by simply attaching the scripts to the same GameObject as the Seeker component is attached to. They will work automatically without any code modifications.

This can for example be a Raycast Modifier 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.

Below is a comparison of a few of the most common types of modifiers/combination of modifiers on a grid graph.

See Also
SimpleSmoothModifier
RaycastModifier
FunnelModifier
RadiusModifier
StartEndModifier
AlternativePath
Modifiers

The AIPath and AILerp movement scripts use modifiers however the RichAI movement script will ignore most of them (all that smooth and simplify the path). The RichAI movement script instead includes its own internal version of the funnel modifier which is slightly more specialized for the RichAI script. You can still attach other modifiers when using the RichAI movement script.

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.

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

You can see a list of all modifiers if you click on Modules above and go to "Modifiers".

See Also
Writing Modifiers