Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class CameraFollow : MonoBehaviour
- {
- public GameObject target;
- public float speed;
- private void Update()
- {
- if (target != null)
- {
- transform.position = Vector3.Lerp(transform.position, target.transform.position, Time.deltaTime * speed);
- transform.forward = Vector3.Slerp(transform.forward, target.transform.forward, Time.deltaTime * speed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement