Improve rotation handling in edge cases

This commit is contained in:
Dean Herbert 2018-07-30 18:50:59 +09:00
parent a39188f762
commit f4cda695e6

View File

@ -101,17 +101,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
break; break;
} }
float aimRotation = MathHelper.RadiansToDegrees( float aimRotation = MathHelper.RadiansToDegrees((float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X));
(float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); while (Math.Abs(aimRotation - Rotation) > 180)
aimRotation += aimRotation < Rotation ? 360 : -360;
if (!hasRotation || Math.Abs(aimRotation - Rotation) > 180) if (!hasRotation)
{ {
Rotation = aimRotation; Rotation = aimRotation;
hasRotation = true; hasRotation = true;
} }
else else
{ {
Rotation = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 100), Rotation, aimRotation, 0, 600, Easing.OutQuint); Rotation = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 100), Rotation, aimRotation, 0, 50, Easing.OutQuint);
} }
} }
} }