diff options
author | chai <215380520@qq.com> | 2023-10-27 11:05:14 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-10-27 11:05:14 +0800 |
commit | 766cdff5ffa72b65d7f106658d1603f47739b2ba (patch) | |
tree | 34d7799a94dfa9be182825577583c0fa6dc935f7 /GameCode/FRILerp.cs |
+ init
Diffstat (limited to 'GameCode/FRILerp.cs')
-rw-r--r-- | GameCode/FRILerp.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/GameCode/FRILerp.cs b/GameCode/FRILerp.cs new file mode 100644 index 0000000..f27815b --- /dev/null +++ b/GameCode/FRILerp.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +public class FRILerp : MonoBehaviour +{ + private void Start() + { + } + + public static Vector3 Lerp(Vector3 from, Vector3 target, float speed) + { + return Vector3.Lerp(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static Vector3 LerpUnclamped(Vector3 from, Vector3 target, float speed) + { + return Vector3.LerpUnclamped(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static float Lerp(float from, float target, float speed) + { + return Mathf.Lerp(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static float LerpUnclamped(float from, float target, float speed) + { + return Mathf.LerpUnclamped(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static Vector3 Slerp(Vector3 from, Vector3 target, float speed) + { + return Vector3.Slerp(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static Vector3 SlerpUnclamped(Vector3 from, Vector3 target, float speed) + { + return Vector3.SlerpUnclamped(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static Quaternion Lerp(Quaternion from, Quaternion target, float speed) + { + return Quaternion.Lerp(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } + + public static Quaternion LerpUnclamped(Quaternion from, Quaternion target, float speed) + { + return Quaternion.LerpUnclamped(from, target, 1f - Mathf.Exp((0f - speed) * TimeHandler.deltaTime)); + } +} |