You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
522 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class NewBehaviourScript : MonoBehaviour
  5. {
  6. public GameObject target;
  7. public float camHeight;
  8. void Follow()
  9. {
  10. Vector3 tempDest = target.transform.position;
  11. tempDest.y = camHeight;
  12. Vector3 destination = Vector3.Lerp(transform.position, tempDest, 1);
  13. transform.position = destination;
  14. }
  15. // Update is called once per frame
  16. void FixedUpdate()
  17. {
  18. Follow();
  19. }
  20. }