mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 21:12:55 +08:00
Merge pull request #18238 from peppy/fix-slider-ball-rotation
Fix slider ball rotation becoming undefined when time is not flowing smoothly
This commit is contained in:
commit
b48308eae2
@ -195,16 +195,16 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
|||||||
|
|
||||||
public void UpdateProgress(double completionProgress)
|
public void UpdateProgress(double completionProgress)
|
||||||
{
|
{
|
||||||
var newPos = drawableSlider.HitObject.CurvePositionAt(completionProgress);
|
Position = drawableSlider.HitObject.CurvePositionAt(completionProgress);
|
||||||
|
|
||||||
var diff = lastPosition.HasValue ? lastPosition.Value - newPos : newPos - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f);
|
var diff = lastPosition.HasValue ? lastPosition.Value - Position : Position - drawableSlider.HitObject.CurvePositionAt(completionProgress + 0.01f);
|
||||||
if (diff == Vector2.Zero)
|
|
||||||
|
// Ensure the value is substantially high enough to allow for Atan2 to get a valid angle.
|
||||||
|
if (diff.LengthFast < 0.01f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Position = newPos;
|
|
||||||
ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
|
ball.Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
|
||||||
|
lastPosition = Position;
|
||||||
lastPosition = newPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FollowCircleContainer : CircularContainer
|
private class FollowCircleContainer : CircularContainer
|
||||||
|
Loading…
Reference in New Issue
Block a user