Hey there,
So I'm working on a Vampire Survivors type of game.
I want to have a knockback area which is always active. So I've decided to make the enemies steer away from my character when they are under a certain distance in pixels (that's what RotationDistance is for).
However, as shown in the video in the last reply to the thread, even if I put 90 degrees for rotation, the directionToPlayer vector doesn't rotate at all that much.
I'm not really sure why. I've coded a RotateVector method to help me with that but tbh, I'm not really sure it's working as intended.
At first I was thinking that maybe the acceleration was the problem but even if that was the problem I don't really know how to solve that.
I'm completely lost right now and I have a hard time putting the math down and all. I'm not particularly good at linear algebra.
As you can see in the video, when I put 600 enemies, the "knockback area" is very little on the first time the enemies go close to the player. This is just a consequence of the previous problem.
And, especially the further away the enemies are, the closer they get to the player, which is why I thought acceleration was the problem.
As an extra info, enemies spawn evenly in concentric circles outside of the camera.
I will provide the code in the next message in the thread.
I hope someone can help me with that because it's kind of a very essential feature of my game.
Thank you a lot for your help in any way!
P.S : For experienced C# programmers, I hope this code is not too shitty, I'm just getting started in C#. (that's also my real first game ever so yeah...). I know the naming is not perfect right now (like I'm changing cases and all) but yeah, I'll go over it later when this is solved.