Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TrackerLerp : MonoBehaviour {
public Transform target;
public float targetFPS = 90.0f;
public float influence = 0.985f;
void LateUpdate () {
float timeScale = 1.0f / targetFPS;
float factor = influence * (Time.deltaTime / timeScale);
transform.position = Vector3.Lerp(transform.position, target.position, factor);
transform.localScale = Vector3.Lerp(transform.localScale, target.localScale, factor);
transform.rotation = Quaternion.Slerp(transform.rotation, target.rotation, factor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment