using System; using UnityEngine; namespace Leap.Unity { [Serializable] public class SmoothedVector3 { public void SetBlend(float blend, float deltaTime = 1f) { this.delay = deltaTime * blend / (1f - blend); } public Vector3 Update(Vector3 input, float deltaTime = 1f) { if (deltaTime > 0f && !this.reset) { float num = this.delay / deltaTime; float num2 = num / (1f + num); this.value = Vector3.Lerp(this.value, input, 1f - num2); } else { this.value = input; this.reset = false; } return this.value; } public Vector3 value = Vector3.zero; public float delay; public bool reset = true; } }