Class Funnel
Implements the funnel algorithm as well as various related methods.
See
http://digestingduck.blogspot.se/2010/03/simple-stupid-funnel-algorithm.html
Usually you do not use this class directly. Instead use the FunnelModifier component.
using UnityEngine; In the image you can see the output from the code example above. The cyan lines represent off-mesh links.
using Pathfinding;
using Pathfinding.Drawing;
public class FunnelExample : MonoBehaviour {
    public Transform target = null;
    void Update () {
        var path = ABPath.Construct(transform.position, target.position);
        AstarPath.StartPath(path);
        path.BlockUntilCalculated();
        // Apply some default adjustments to the path
        // not necessary if you are using the Seeker component
        new StartEndModifier().Apply(path);
        // Split the path into segments and links
        var parts = Funnel.SplitIntoParts(path);
        // Optionally simplify the path to make it straighter
        var nodes = path.path;
        Funnel.Simplify(parts, ref nodes);
        using (Draw.WithLineWidth(2)) {
            // Go through all the parts and draw them in the scene view
            for (int i = 0; i < parts.Count; i++) {
                var part = parts[i];
                if (part.isLink) {
                    // Draw off-mesh links as a single line
                    Draw.Line(part.startPoint, part.endPoint, Color.cyan);
                } else {
                    // Calculate the shortest path through the funnel
                    var portals = Funnel.ConstructFunnelPortals(nodes, part);
                    var pathThroghPortals = Funnel.Calculate(portals, unwrap: true, splitAtEveryPortal: false);
                    Draw.Polyline(pathThroghPortals, Color.black);
                }
            }
        }
    }
}
 
 
Inner Types
Public Static Methods
Calculate the shortest path through the funnel.
Simplifies a funnel path using linecasting.
Splits the path into a sequence of parts which are either off-mesh links or sequences of adjacent triangles.
Unwraps the funnel portals from 3D space to 2D space.
Private/Protected Members
Funnel algorithm.
Try to fix degenerate or invalid funnels.
True if b is to the left of or on the line from (0,0) to a.
True if b is to the right of or on the line from (0,0) to a.


 The output will be a funnel in 2D space like in the image below. All twists and bends will have been straightened out.  