Stuttering Movement on unit when close the target point

Hey there,

I brought the pro version of the project now and want to integrate local avoidance and recast graphs now.

I followed the tutorial for recast graph on the documentation. I have a basic cylinder with an RVO Controller and a RichAI script.

The code works fine, but when the unit comes close the target or below the endReachedDistance the movement stops (what is good) and then stutters to the target. May this be connected with the “repeatedly search paths” option: I set this to true.

Help’s welcome
T_Schm

Hi

Yes. Sorry that is a known issue. It will move for a very short time before stopping again.
You could solve it by in the OnPathComplete method, check if the distance to the target is less than some value, then just throw away the new path.

How would you advise doing this?

I tried p.Release(this) and I get an ArgumentException if there is no path and if I use p.Reset() it breaks the AI and won’t move anywhere.

Found solution that doesn’t seem to break anything else:

In OnPathComplete, at top put:

float targetDistance = Vector3.Distance(transform.position, target.position);
if (targetDistance <= endReachedDistance)
{
    delayUpdatePath = true;
}

Then when you want AI to move again:

if (delayUpdatePath)
{
    delayUpdatePath = false;
    UpdatePath();
}