RichAI know if agent is currently on a NodeLink path

I was wondering if there is a way to tell if my RichAi agent is moving on a nodelink ?

I have a ladder where the agent is supposed to climb and i want to run that animation if the RichAI choses that path to the destination. Does anyone know how i can achieve this?

If you have the Pro version you can take a look at the Recast Example scene 2.

There is an miscellaneous script AnimationLink that should work for this usecase. ( also included in the free version )

1 Like

Hi

The component NodeLink is identical one of graph’s own connections and is not detectable at all. You can use the NodeLink2 component (sorry about the terrible names…) which has a detectable link.

If you use that you can either use the RichAI.onTraverseOffMeshLink delegate which allows you to use a coroutine to control exactly what happens when the agent traverses the link (e.g. play an animation or whatever) or you can use the RichAi.traversingOffMeshLink boolean which is true while the agent traverses the link.

See https://arongranberg.com/astar/docs/richai.html#onTraverseOffMeshLink
See https://arongranberg.com/astar/docs/richai.html#traversingOffMeshLink

Solved / Aipath dont have lerp animation and path good with link2 .
i will not delete this post maybe it will help to somebody

oldpost ///
Is it possible to turn off default Lerp animation in Rich Ai for Link2 ? the bad thing that i use Visual Scripting Flow Canvas and dont have knowledge to stop Lerp with it.

At this moment i use Link1 with colliders (red arrows) and i start tween movement when unit trigger collider


all works good but I want to use Link2 the same way ( becouse it is even more precise path then link1) but it plays own lerp animation and dont let play my tweens /

if no way atm i have request for future- add boolean in rich ai or link2- use default lerp animation or not

maybe will be helpful for non code persons like me
i modified anim traverse script code. very simple- i cant more /must be placed on richai unit+link2

this will stop richAi on first node-and wait for your dotween action
and when it finish wait for bool traverse will be pressed .
unit must be near node 2 at that moment or it will be jump/
traverse

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pathfinding;

public class Traverse : MonoBehaviour
{
    // Start is called before the first frame update

    public bool Traverse2 = false;

    RichAI ai;

    void OnEnable()
    {
        ai = GetComponent<RichAI>();
        if (ai != null) ai.onTraverseOffMeshLink += TraverseOffMeshLink;
    }

    void OnDisable()
    {
        if (ai != null) ai.onTraverseOffMeshLink -= TraverseOffMeshLink;
    }

    protected virtual IEnumerator TraverseOffMeshLink(RichSpecial rs)
    {


        while (true)
        {


            if (Traverse2 == true) break;
            yield return null;
        }
    }
}