I have a problem with RichAI seeker target update

Hello @aron_granberg

I’m using v 4.3.25, and unity 2019.4.2f1 LTS

video

I’m calculating the direction for playing turn state all the time, but it looks like some times the seeker target skipping frames.

Help me, please

After this block I guess, am I right?
Is this one updating the seeker target ?

a_Unit.Agent.AI.MovementUpdate(Time.deltaTime, out nextPosition, out nextRotation);
animator.deltaRotation.eulerAngles);

a_Unit.m_rigidbody.position = animator.rootPosition;
a_Unit.m_rigidbody.rotation = animator.rootRotation;

nextPosition = a_Unit.m_rigidbody.position;
nextRotation = a_Unit.m_rigidbody.rotation;

 a_Unit.Agent.AI.FinalizeMovement(nextPosition, nextRotation);

but I don’t understand how to increase the seeker target updating area.

need some tip )

@aron_granberg looks like it’s just going through steering target for one frame and then choosing the next one.

help pls :confused:

@aron_granberg , have updated to 4.3.29, same situation. I feel like it is not a bug, but need some tip how to prevent that.

@aron_granberg some times it is updating to the next target with a good distance before, but some times when the character has passed through, hm :thinking:

Hi @aron_granberg , I have to calculate distance to steering target yep?
if it small, then ignore direction?

The steeringTarget will be updated when the MovementUpdate method is called. Since the agent moves after the MovementUpdate call then it will end up being the correct steering target for the previous position of the AI.

You can force it to recalculate the steering target by calling ai.GetRemainingPath(…).
See https://arongranberg.com/astar/docs/iastarai.html#GetRemainingPath

1 Like

Hi @aron_granberg, thank you for help!

I’m doing like that before getting direction, looks like working for me. Am I doing right? :

a_Unit.Agent.AI.GetRemainingPath(pathBuffer, out stale);

if(pathBuffer.Count > 1)
   steeringTarget = pathBuffer[1];

Is it good enough for not loosing performance?
I’m doing it in Update

Oh and I can’t use ai.steeringTarget anymore, yep?

That will work, yes.

1 Like

Hi @aron_granberg I’m totally confused …
Now I have with NodeLink2 problems
And has an unexpected result with that pathBuffer, what should I do?
Video with the problem

Oh, you said the right answer … “The steeringTarget will be updated when the MovementUpdate method is called.” it was so obvious that the direction I should find right after MovementUpdate and before FinalizeMovement and else code… I have absolutely no idea how I could have missed that

1 Like