Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
Add Comment
Please, Sign In to add comment