Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / OldCameraController.cs
@Rackday Rackday on 18 Aug 653 bytes Project Added
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OldCameraController : MonoBehaviour
{
    public Transform target;
    public float smoothing;
    void Start()
    {

    }

    void LateUpdate()
    {
        transform.position = new Vector3(target.transform.position.x, target.transform.position.y, transform.position.z);
        if (transform.position != target.position)
        {
            Vector3 targetPosition = new Vector3(target.position.x, target.position.y, transform.position.z);
            transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing);
        }
    }
}