I’m making a basic 2D top-down shooter and right now I’m spawning a bunch of simple cube gameobjects which are chasing the player with the following logic:
Vector3 pos = player.transform.position - gameObject.transform.position; pos.Normalize(); gameObject.transform.Translate(pos * enemySpeed);
They chase fine, but to make them feel a bit more ‘alive’ I wanted to make them spin in circles while chasing the player. I have been able to get them to rotate using:
gameObject.transform.Rotate(0, 0, 90 * Time.deltaTime);
The problem is this also effected the movement. How would I go about getting these objects to rotate in a circle without effecting the chase movement?