Hi, I’m using Detour Crowd AI controller to have my AI bots avoid each other when walking along the same path. However I also want the neutral bots to avoid the player when walking towards him. As of now, they just collide with the player character and may just slide forcefully to the side or just stay there trying to move through the player. Any way to get the AI to path around the player while using Detour?
I’m not sure my way is the the most efficient or even an acceptable answer to some but here it goes:
I put some boxtriggers on my AI that fires a custom event in the AI’s blueprint I called Evade. What it does is it checks if the actor in the boxtrigger has the tag of ‘Player’ and if the actor does I get the players location in a vector.
Based off of that vector I tell my AI to either go left or right (whichever is closer to his original goal) by getting/calculating a vector about 2 meters right or left of the player. Then I tell the AI to go to that vector. Once he reaches the vector I then tell him to move to his original goal.
Like I said, not very efficient but works
But how do you know if this random point on the left/right lies on the nav mesh?
You take your AI’s forward vector, which you can then use to determine left or right.