I’m making the enemy follow the player only straight or diagonally e.g.(1,1)(1,0)(0,1)(-1,1).
I expected the problem I have but I don’t really know how to fix it. When my enemy is placed diagonally relative to the player but not exactly, altern rapidly between going diagonally and straight, causing it to appear like its vibrating
there is the simple script returning the vector2 to follow:
Vector2 direction = (player.position - goblinTr.position).normalized; direction.x = Mathf.Round(direction.x); direction.y = Mathf.Round(direction.y); return direction;