FleePath inconsitency

I made a test room for flee path: an unit with AIPath following its target, another with a custom class inherited from AIPath (changes from basic AIPath to FleePath by pressing a button)

I find quite often my fleeing unit trying to run through the seeking unit even though it should be able to circle around the room and has more move speed.

In this picture the fleeing unit is on the right, it should go down to flee but tries to cross the other unit instead.

Most of the time it flees correctly but it has these moments, I am not sure how to take care of…

Btw this is how I implemented a change between follow and Flee :

public override void SearchPath()
		if (isFeared)
			if (fleePathApplied)
			Debug.Log($"Calculating Fleepath");
			fleePathApplied = true;
			// Create a path object
			FleePath path = FleePath.Construct(transform.position, destination, fleePathLength);
			// This is how strongly it will try to flee, if you set it to 0 it will behave like a RandomPath
			path.aimStrength = 1;


I believe if the two agents are pretty close to each other this can happen. However you can mitigate it by increasing the ‘aimStrength’ field.

Thank you, it does the trick.
I could not find a range for aimStrength, as it is a float I assumed it was a 0 to 1 range

1 Like