TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ AngleLerp()

static float Terraria.Utils.AngleLerp ( this float curAngle,
float targetAngle,
float amount )
inlinestatic

Definition at line 1927 of file Utils.cs.

1928 {
1929 float angle;
1930 if (targetAngle < curAngle)
1931 {
1932 float num = targetAngle + (float)Math.PI * 2f;
1933 angle = ((num - curAngle > curAngle - targetAngle) ? MathHelper.Lerp(curAngle, targetAngle, amount) : MathHelper.Lerp(curAngle, num, amount));
1934 }
1935 else
1936 {
1937 if (!(targetAngle > curAngle))
1938 {
1939 return curAngle;
1940 }
1941 float num2 = targetAngle - (float)Math.PI * 2f;
1942 angle = ((targetAngle - curAngle > curAngle - num2) ? MathHelper.Lerp(curAngle, num2, amount) : MathHelper.Lerp(curAngle, targetAngle, amount));
1943 }
1944 return MathHelper.WrapAngle(angle);
1945 }