using UnityEngine;
using System.Collections;
public class LookAtFixed : MonoBehaviour {
public Transform lookAt;
void Update()
{
Vector3 worldLookDirection = lookAt.position - transform.position;
Vector3 localLookDirection = transform.InverseTransformDirection(worldLookDirection);
localLookDirection.y = 0;
transform.forward = transform.rotation * localLookDirection;
}
}
using UnityEngine;
using System.Collections;
public class LookAt : MonoBehaviour {
public Transform lookAt;
void Update() {
transform.LookAt(lookAt);
}
}