How do i make that rocket rotate it self in the z axis to go to that player in the game when it spawn in a random place? Like in that pic ?
Transform.LookAt does not work very well in 2D. I would use Mathf.Atan2 instead:
Vector3 difference = playerPosition - rocketPosition; // Switch these two if rocket points away
float angle = Mathf.Atan2(difference.y, difference.x); // Calculate the angle
rocketTransform.eulerAngles = new Vector3(0, 0, angle); // Rotate the rocket
is this what you are looking for:
Transform.LookAt?
