using System.Collections; using System.Collections.Generic; using UnityEngine; public class LookAtMovement : MonoBehaviour { private Vector3 lastPos = Vector3.zero; public float slerpAlpha = 0.025f; // Update is called once per frame void Update() { transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(transform.position - lastPos, Vector3.up), slerpAlpha); } private void LateUpdate() { lastPos = transform.position; } }