- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class NewBehaviourScript : MonoBehaviour
- {
- public GameObject target;
- public float camHeight;
-
- void Follow()
- {
- Vector3 tempDest = target.transform.position;
- tempDest.y = camHeight;
- Vector3 destination = Vector3.Lerp(transform.position, tempDest, 1);
- transform.position = destination;
- }
-
- // Update is called once per frame
- void FixedUpdate()
- {
- Follow();
- }
- }
|