Fleepath returning to player

Hi I am having an issue with fleepath where the destination seems to return to the player regardless of how I tweak the other variables?
I have tried adjusting flee distance and it shouldn’t be an issue as there is plenty of space to flee.
I have also tried adjusting aim strength to the max (1) but the end of the path seem to lead back to the player.

I am setting the path by using AIPath.SetPath(FleePath) if that clarifies things.

m_FleePath = FleePath.Construct(transform.position,Player.transform.position,fleeMaxDistance);
m_FleePath.aimStrength = fleeRandomness;
m_FleePath.spread = 0;
runtime.m_Agent.SetPath(m_FleePath);

Hi

I would recommend that you do not set spread to zero. That means only nodes exactly fleeMaxDistance away are valid endpoints. This is usually not beneficial since there may not be any nodes with exactly that distance from the start. Use some other threshold like maybe max(1000, fleeMaxDistance).

I’m not sure if this is the source of your problems, but it’s a good start anyway.