diff --git a/Assets/VRM/Runtime/LookAt/CurveMapper.cs b/Assets/VRM/Runtime/LookAt/CurveMapper.cs index 6f9b0490c9..15069c1de4 100644 --- a/Assets/VRM/Runtime/LookAt/CurveMapper.cs +++ b/Assets/VRM/Runtime/LookAt/CurveMapper.cs @@ -62,7 +62,8 @@ IEnumerable ToKeys(float[] values) public float Map(float src) { // https://github.com/vrm-c/UniVRM/issues/2452 - return Curve.Evaluate(Mathf.Clamp(src, 0, 1) / MathF.Max(CurveXRangeDegree, 0.001f)) * CurveYRangeDegree; + var t = Mathf.Clamp01(Mathf.Clamp(src, 0, 1) / MathF.Max(CurveXRangeDegree, 0.001f)); + return Curve.Evaluate(t) * CurveYRangeDegree; } public bool Equals(CurveMapper other) diff --git a/Assets/VRM10/Runtime/Components/LookAt/CurveMapper.cs b/Assets/VRM10/Runtime/Components/LookAt/CurveMapper.cs index 8beaf22c6f..a2be36e4e8 100644 --- a/Assets/VRM10/Runtime/Components/LookAt/CurveMapper.cs +++ b/Assets/VRM10/Runtime/Components/LookAt/CurveMapper.cs @@ -30,7 +30,8 @@ public void OnValidate() public float Map(float src) { // https://github.com/vrm-c/UniVRM/issues/2452 - return Mathf.Clamp(src, 0, CurveXRangeDegree) / Mathf.Max(0.001f, CurveXRangeDegree) * CurveYRangeDegree; + var t = Mathf.Clamp01(Mathf.Clamp(src, 0, CurveXRangeDegree) / Mathf.Max(0.001f, CurveXRangeDegree)); + return t * CurveYRangeDegree; } } } \ No newline at end of file