Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class LookAtTarget : MonoBehaviour
- {
- public Transform target;
- void Update()
- {
- Quaternion targetRot = Quaternion.LookRotation(target.position - transform.position);
- transform.rotation = Quaternion.Slerp(transform.rotation, targetRot, 2f * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment