Hello. I would like some general tips or perhaps overall concepts to avoidance behaviour. I currently have come up with a somewhat working solution involving mirroring what I want to advoid, but if you couldn't guess, that only half works as mirrors are like that. I've heard about steering behaviour but it sounds more complicated then I want, but if there isn't any better way I suppose it could work. Path finding is also related to avoidance behaviour but with my paths changing so often I'm not sure if that is the best method.
Currently for some quick advoidance behaviour I have been using this code snippet I came up with.
transform.position = Vector3.MoveTowards(transform.position, -myPlayer.player.position, moveSpeed * Time.deltaTime);
I know that getting by normalizing the transform.position and player position I can tell if the player is moving closer to me as the normalized variable remains the same... But I'm not sure what to do with that, I've never taken any decent math classes....
direction = transform.position - myPlayer.player.position;
direction.Normalize();
if I could somehow check if I'm getting the same result from normalize constently and then reverse my direction, that would probably solve my whole issue. Maybe...
Any advice or perhaps websites that go into detail on this sort of thing? This avoidance behaviour will be used on a large group or herd of objects to advoid other herds and enemies.