using System.Collections; using System.Collections.Generic; using UnityEngine; public class FaceTo : MonoBehaviour { public Transform target; void Update() { if (target == null) return; Vector3 dir = target.position - transform.position; dir = dir.normalized; Vector3 faceto = Vector3.ProjectOnPlane(dir, Vector3.up).normalized; transform.rotation = Quaternion.LookRotation(faceto, Vector3.up); } }