Skip to content

Commit

Permalink
Improve slider body generation
Browse files Browse the repository at this point in the history
  • Loading branch information
EVAST9919 committed Mar 30, 2024
1 parent ccc984c commit e7a29d7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions osu.Game.Rulesets.Bosu/Extensions/ConversionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,22 @@ public static IEnumerable<BosuHitObject> GenerateSliderBody(double startTime, IH
{
List<InstantCherry> bodyCherries = new List<InstantCherry>();

var bodyCherriesCount = Math.Min(curve.Distance * (curve.RepeatCount + 1) / 15, max_visuals_per_slider_span * (curve.RepeatCount + 1));
var bodyCherriesCount = (int)(curve.Distance * (curve.RepeatCount + 1) / 15);

Vector2 lastPosition = new Vector2(-10000, -10000);

for (int i = 0; i < bodyCherriesCount; i++)
{
var progress = i / bodyCherriesCount;
var position = curve.CurvePositionAt(progress) + originalPosition;
position = toPlayfieldSpace(position * new Vector2(1, 0.4f));
var progress = i / (float)bodyCherriesCount;
Vector2 position = toPlayfieldSpace((curve.CurvePositionAt(progress) + originalPosition) * new Vector2(1, 0.4f));

if (i != 0 && i != bodyCherriesCount - 1)
{
if (Vector2.Distance(position, lastPosition) < 5)
continue;
}

lastPosition = position;

if (withinPlayfield(position))
{
Expand Down

0 comments on commit e7a29d7

Please sign in to comment.