Support Forum

ABPath.Construct zig zags

Is it possible to construct straighter path using (currently getting path placed on center of graph nodes):

ABPath path = ABPath.Construct(Position, TargetPosition, _PathCalculated);
path.heuristic			= Heuristic.DiagonalManhattan;
AstarPath.StartPath(path);

I wan’t to avoid creating game objects and using mono behaviour with seekers and other modifiers that need monobehaviour.

image

Hi

For a navmesh-based graph I recommend that you add the FunnelModifier to straighten out the path. See Documentation

Note that you can calculate the path separately without using a Seeker, and then just call seeker.PostProcess(path) to only use the modifier stack for the seeker without the rest of it.

Not sure if I undestand the usage of this without actual code example.
seeker.PostProcess(path) - is seeker a component (not static)? this gives me a null error if so.
do I need to attach a funnel modifier to the seeker object?

I guess I can just do this. Seems to work.

private void _PathCalculated(Path p)
{
     FunnelModifier f = new FunnelModifier();
     f.Apply(p);
     Path = p.vectorPath;
}

Would be cool to alternatively have these functions on modifiers as static.

You can technically, but Unity will complain since FunnelModifier is a MonoBehavior. I’d recommend attaching it once to some object and then just using it via a reference.