quakeball/Assets/Scripts/Animation/LerpFollower.cs

18 lines
656 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace NeonTea.Quakeball.Animation {
/// <summary>Follows a Transform with configurable lerp speeds.</summary>
public class LerpFollower : MonoBehaviour {
public Transform Followed;
public Vector3 PositionLerpSpeed = new Vector3(100, 100, 100);
public Vector3 RotationLerpSpeed = new Vector3(100, 100, 100);
public Vector3 ScaleLerpSpeed = new Vector3(100, 100, 100);
private void Update() {
transform.position.x = Mathf.Lerp(transform.position.x, Followed.position.x, PositionLerpSpeed.x);
}
}
}