Mathf.LerpAngle replacement missing

Hello,

I could not find Mathf.LerpAngle replacement in TrueSync.

Could you please share a code to replace Mathf.LerpAngle ?

Regards

Comments

  • I added the following code to TSMath. It seems working :)

    I used the code in this repository : https://github.com/MattRix/UnityDecompiled/blob/master/UnityEngine/UnityEngine/Mathf.cs

    public static FP LerpAngle(FP a, FP b, FP t)
    {
    FP num = Repeat(b - a, FP.FromFloat(360f));
    if (num > FP.FromFloat(180f))
    {
    num -= FP.FromFloat(360f);
    }
    return a + num * Clamp01(t);
    }

    public static FP Clamp01(FP value)
    {
    FP result;
    if (value < FP.Zero)
    {
    result = FP.Zero;
    }
    else if (value > FP.One)
    {
    result = FP.One;
    }
    else
    {
    result = value;
    }
    return result;
    }

    public static FP Repeat(FP t, FP length)
    {
    return Clamp(t - Floor(t / length) * length, FP.Zero, length);
    }
Sign In or Register to comment.