AI roam within area

Hi there. I am having a question about roaming Ai

I want cows roaming around in their pen in a open world scenario +(like on a farm surrounded by fences). I want to have a gate within the fence for players to move in and out. However in the case this gate would stay open, I do not want my cows to walk out. I have considered adjusting the radius they can walk in, but then they would never go into the corners of the pen which is unrealistic (since they would stay within a circle and not a square). I tried making the nav bounds volume to just the size of the pen, but then I cannot walk outside of it with my character. How can I make it so my player character can walk anywhere, but my cows are very obedient and stay within their pen with the gate open?

You could have the cows use the Get Random Point Within bounds node (or whatever it is called) each time they choose a MoveTo target location, and make sure those bounds are within the fence.

I kind of understood what you meant, and I came up with this solution: Split the destination pin and give the random float values of the corners of the pen. It might only work with square pens, but that is fine with me :stuck_out_tongue:

248911-ue4aimovefix.png