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

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();
}
}