Fix generation for zero-length sliders

This commit is contained in:
Henry Lin 2022-04-01 11:47:21 +08:00
parent af3835083c
commit c0a78924aa
1 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Utils;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
using osuTK;
@ -167,7 +168,8 @@ private static void computeModifiedPosition(WorkingObject current, WorkingObject
centreOfMassModified = RotateAwayFromEdge(current.PositionModified, centreOfMassModified);
float relativeRotation = (float)Math.Atan2(centreOfMassModified.Y, centreOfMassModified.X) - (float)Math.Atan2(centreOfMassOriginal.Y, centreOfMassOriginal.X);
RotateSlider(slider, relativeRotation);
if (!Precision.AlmostEquals(relativeRotation, 0))
RotateSlider(slider, relativeRotation);
}
/// <summary>
@ -316,6 +318,8 @@ private static Vector2 clampToPlayfieldWithPadding(Vector2 position, float paddi
private static Vector2 calculateCentreOfMass(Slider slider)
{
if (slider.Distance < 1) return Vector2.Zero;
int count = 0;
Vector2 sum = Vector2.Zero;
double pathDistance = slider.Distance;