Follow and Rotate an object


I have 2 objects in a scene. 1 - enemy that spawns in the middle of a circle and 2 - the player.

Now my problem is, I want the player to rotate in a 360degree angle and follow the enemy.

Here’s a sample image.

The ENEMY moves randomly at start and the PLAYER is just moving in a CIRCULAR direction FOLLOWING the ENEMY position. How do I rotate the PLAYER and follow the direction of the ENEMY?

Thanks in advance!

I think you might use Transform.RotateAround and pass it the transform.position of the enemy in the Update();

function RotateAround (enemy.transform.position:Vector3, axis:Vector3, angle:float) : void 

You might want to combine it with Transform.LookAt() if you need the player to always be facing the enemy.

Hope that helps.