Adjusting vectorPath has no effect?

Hey Aron,

I am trying to use LimitLength() from this post: Link

I am trying to adjust ABPath.vectorPath, but the _navAgent seems to ignore this, and uses the unmodified version:

// Construct a path TOWARDS the "destination", and see if too far.
        ABPath p = ABPath.Construct(transform.position,  _destination);
        p.nnConstraint.tags = NavTagMasks.playerWalkable; //only allow to walk on this tag
        AstarPath.StartPath(p);
        yield return p.WaitForPath();
        _navAgentSeeker.PostProcess(p);

        //test to see if vector-path adjustment works.  Set to 2 same coords:
        p.vectorPath.Clear();
        p.vectorPath.Add( _navAgent.position );
        p.vectorPath.Add( _navAgent.position );

        navAgent.SetPath(p);//RichAI

Later in my other Moving-coroutine I call:

        Vector3 wantedPos_ai;
        Quaternion wantedRot_ai;
        //compute how the ai wants to move:
        _navAgent.MovementUpdate( Time.deltaTime,  out wantedPos_ai,  out wantedRot_ai );
         
        /*some more code*/

       _navAgent.FinalizeMovement( nextPos,  nextRot );

I expected the creature to remain in place, but it seems to use the original path when stopping at a breakpoint in Visual Studio. In Unity3D the monster indeed runs via the original (non-truncated path) :frowning:

here I am using RichAI.SetPath() and AStar version 4.4.2

Do I forget to call something / using wrong approach?

Thanks!

Hi

The RichAI movement script is unique in that it does not use the vectorPath at all, it instead uses the path field which is a list of nodes. The RichAI script uses this node list internally to follow the shortest path within that corridor of nodes using the funnel algorithm.

If you want to modify the vectorPath you might want to use the AIPath script instead.

1 Like