using UnityEngine;
using System.Collections;
public class EnemyLook : MonoBehaviour {
public Transform playerPosition;
public Quaternion rotationAngleX;
public float TurnSpeed = 5;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
rotationAngleX = Quaternion.LookRotation(playerPosition.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotationAngleX, Time.deltaTime * TurnSpeed);
}
}
This does work just great, but works on 3D plane, while I work on 2D game.
I just barely worked out to get it working, I seriously have no idea how to get it on 2D plane.