Support Forum

How do not add endNode to the current path using NodeLink2? or ai.GetRemainingPath works not how I was expecting

Hi @aron_granberg!

I’m trying to figure out how to update a steeringTarget while the RichAI.traversingOffMeshLink is true

Video how the problem looks like

video with the problem slower

because I have a couple of frames when the direction is wrong, so the animation sometimes played badly when the direction to steeringTarget shows 180 or -180

this is my favorite:

If not recalculate the path after TraverseOffMeshLink

Looks like even after passing the link, steeringTarget is the link’s endpoint;

this is how I’m updating steeringTarget after FinalizeMovement:

public override Vector3 SteeringTarget
            {
                get
                {
                    ai.GetRemainingPath(pathBuffer, out stale);

                    if (pathBuffer.Count > S_Number.ONE)
                        return pathBuffer[S_Number.ONE];
                    else return ai.steeringTarget;
                }
            }

direction angle:

directionalMovement = Quaternion.Inverse(a_Unit.m_transform.rotation) * a_Unit.Agent.AI.desiredVelocity;

relative = a_Unit.m_transform.InverseTransformPoint(a_Unit.Agent.SteeringTarget);
            
directionAngle = Mathf.Atan2(relative.x, relative.z) * Mathf.Rad2Deg;

SteeringTargetDebug

pathBuffer Debug

ai.GetRemainingPath is getting the pathBuffer with link’s endpoint as a second item in the list and doesn’t update until rebuild the path or next link has played, rebuild the path has not suited the case cause it has a couple of frames to wait while path pending and direction shows wrong params

What should I do? )
Or mb how do not add the link’s endpoint to the path?