IT lexicon › Programming › Funnel algorithm

Funnel algorithm

Programming På svenska → Updated: 2026-10-25

Extracts the true shortest path through a corridor of navmesh triangles once pathfinding has worked out which triangles the route crosses.

A* over a navmesh hands you a list of triangles, not a path. Join their centres naively and you get a needlessly long zigzag. The funnel algorithm instead treats the edges shared between consecutive triangles as a sequence of portals and spans a funnel between the left and right sides. It tightens the funnel edge by edge; the moment the left and right sides cross, it drops a waypoint at the innermost corner and starts a fresh funnel from there. The effect is like pulling a string taut through the corridor.

The groundwork is Hershberger and Snoeyink's (1994); the game world mostly knows it through Mikko Mononen's compact "simple stupid funnel algorithm". It is the obvious post-processing step between the triangle search and the line an agent actually walks.

← Back to the lexicon