I'm currently making a survival simulation game, and I need help desperately with the AI. I made a thread about this a while ago but I don't think I explained it well enough. I already have a system for the prey to detect the predator (you), but getting the prey to actually run away from the player is a problem. I've uses a method of changing it's angle once it is supposed to run away from me every tick to 180% towards the player and in this same tick -180 degrees away from the player. I also use bullet movement. The ultimate problem I'm having though is that I have no idea how to make it turn away from objects on the layout. Say there is a tree in the way, what do I use for it to detect the tree individually as a single instance, and have it turn away from said object. Walls are also a big problem, as once it turns, say, 90%, it will still be facing the wall or running along it, causing it to glitch. When the prey turns away however, using the system I use (line of sights detection 'collision boxes' and increasing angle clockwise by 90%), It is also at the same time turning away from the player which causes it to not really turn at all and just spaz through entire walls or mountains.
So, any suggestions on how to make an object 'run away' from the player and detect walls / other objects infront of it, therefore turning it away?