A* Pathfinding Project  4.3.7
The A* Pathfinding Project for Unity 3D
FunnelModifier Class Reference

Simplifies paths on navmesh graphs using the funnel algorithm. More...

Detailed Description

Simplifies paths on navmesh graphs using the funnel algorithm.

The funnel algorithm is an algorithm which can, given a path corridor with nodes in the path where the nodes have an area, like triangles, it can find the shortest path inside it. This makes paths on navmeshes look much cleaner and smoother.

The funnel modifier also works on grid graphs however since it only simplifies the paths within the nodes which the original path visited it may not always simplify the path as much as you would like it to. The RaycastModifier can be a better fit for grid graphs.

Note
The Pathfinding.RichAI movement script has its own internal funnel modifier. You do not need to attach this component if you are using the RichAI movement script.
See also
http://digestingduck.blogspot.se/2010/03/simple-stupid-funnel-algorithm.html

Public Types

enum  FunnelQuality { Medium, High }
 

Public Member Functions

override void Apply (Path p)
 Called for each path that the Seeker calculates after the calculation has finished. More...
 
- Public Member Functions inherited from MonoModifier
virtual void PreProcess (Path path)
 

Public Attributes

FunnelQuality quality = FunnelQuality.Medium
 Determines if funnel simplification is used. More...
 
bool splitAtEveryPortal
 Insert a vertex every time the path crosses a portal instead of only at the corners of the path. More...
 
bool unwrap = true
 Determines if twists and bends should be straightened out before running the funnel algorithm. 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 VersionedMonoBehaviour
int Util.IEntityIndex. EntityIndex [get, set]
 Internal entity index used by #BurstBatchHelper. More...
 
- Properties inherited from IEntityIndex
int EntityIndex [get, set]
 
- Properties inherited from IPathModifier
int Order [get]
 

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 void Reset ()
 Handle serialization backwards compatibility. More...
 

Member Enumeration Documentation

◆ FunnelQuality

enum FunnelQuality
strong
Enumerator
Medium 
High 

Member Function Documentation

◆ Apply()

override void Apply ( Path  path)
virtual

Called for each path that the Seeker calculates after the calculation has finished.

Implements MonoModifier.

Member Data Documentation

◆ quality

Determines if funnel simplification is used.

When using the low quality setting only the funnel algorithm is used but when the high quality setting an additional step is done to simplify the path even more.

On tiled recast/navmesh graphs, but sometimes on normal ones as well, it can be good to simplify the funnel as a post-processing step to make the paths straighter.

This has a moderate performance impact during frames when a path calculation is completed. This is why it is disabled by default. For any units that you want high quality movement for you should enable it.

See also
#Funnel.Simplify

◆ splitAtEveryPortal

bool splitAtEveryPortal

Insert a vertex every time the path crosses a portal instead of only at the corners of the path.

The resulting path will have exactly one vertex per portal if this is enabled. This may introduce vertices with the same position in the output (esp. in corners where many portals meet).

◆ unwrap

bool unwrap = true

Determines if twists and bends should be straightened out before running the funnel algorithm.

If the unwrap option is disabled the funnel will simply be projected onto the XZ plane. If the unwrap option is enabled then the funnel may be oriented arbitrarily and may have twists and bends. This makes it possible to support the funnel algorithm in XY space as well as in more complicated cases, such as on curved worlds.

Note
This has a performance overhead, so if you do not need it you can disable it to improve performance.

See also
Pathfinding.Funnel.Unwrap for more example images.
Note
This is required if you want to use the funnel modifier for 2D games (i.e in the XY plane).

Property Documentation

◆ Order

override int Order
get

The documentation for this class was generated from the following file: