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.

17 lines
508 B

using UnityEngine;
using System.Collections;
public class BasicCameraFollow : MonoBehaviour
{
public GameObject followTarget;
private Vector3 targetPos;
public float moveSpeed;
void Update ()
{
targetPos = new Vector3(followTarget.transform.position.x, followTarget.transform.position.y, transform.position.z);
Vector3 velocity = targetPos - transform.position;
transform.position = Vector3.SmoothDamp (transform.position, targetPos, ref velocity, 1.0f, moveSpeed * Time.deltaTime);
}
}