Set Stopping Distance

Hi, I have readed in the forums and documentation but I can not find a stopping distance for a RichAI.

I am setting up a target transform destination by the Seeker, but, how can I tell the ia to stop when is in a certain distance?
CanMove = false is not an option, because the script animator that checks if the agent is moving by ai.reachedEndOfPath and sk.IsDone() is not compatible with CanMove.

Any suggestions? Thank you!

Hi

For the RichAI there is currently no exposed setting for that in the inspector. However you can put something like this in a separate script:

void Update () {
    ai.isStopped = Vector3.Distance(ai.position, ai.destination) < someThreshold;
}

Thank you it works :slight_smile:

Hi Aron, this works if I set the destination withaIDestinationSetter.target,
but if I set with the seeker.StartPath will not work.

I need it with the Seeker. Is that possible? Because seeker has not a “destination” parameter, and if I check ai.destination is “infinity”.

Hi

You set the destination on the movement script (i.e. RichAI).

GetComponent<RichAI>().destination = someValue;

Make sure that you do not have a AIDestinationSetter component at the same time though, as that will override whatever destination that you set.

Thank you, it worked :slight_smile:

1 Like