So I am working on some combat for my game… I have several enemy’s wandering in an area. When the player attacks they will come towards the player. I use this code to get a position in front of the player:
var dir = player.position - transform.position;
var playerpoint : Vector3 = player.position - dir.normalized * 2;
Now this works nice. But if I have 3 enemy’s attacking me (melee), and I walk around a bit. They eventually gather all up at the same spot, which is of course not what I want.
Can someone give me directions for this code to let it also check how many enemy’s are next to the player (with TAG Enemy). And get a position next to the player but also next to the other enemy so they all gather around the player nicely (maybe in a circle).
Hope someone can help!