use cursor position instead of destination for dampLength calculation

the destination vector is clamped within playfield borders, we want dampLength to be based on distance from the cursor.
This commit is contained in:
Gabe Livengood 2022-07-10 01:22:22 -04:00
parent a606d545c1
commit 6443338251
No known key found for this signature in database
GPG Key ID: 70321B78DAECE683

View File

@ -69,24 +69,24 @@ namespace osu.Game.Rulesets.Osu.Mods
switch (drawable) switch (drawable)
{ {
case DrawableHitCircle circle: case DrawableHitCircle circle:
easeTo(circle, destination); easeTo(circle, destination, cursorPos);
break; break;
case DrawableSlider slider: case DrawableSlider slider:
if (!slider.HeadCircle.Result.HasResult) if (!slider.HeadCircle.Result.HasResult)
easeTo(slider, destination); easeTo(slider, destination, cursorPos);
else else
easeTo(slider, destination - slider.Ball.DrawPosition); easeTo(slider, destination - slider.Ball.DrawPosition, cursorPos);
break; break;
} }
} }
} }
private void easeTo(DrawableHitObject hitObject, Vector2 destination) private void easeTo(DrawableHitObject hitObject, Vector2 destination, Vector2 cursorPos)
{ {
double dampLength = Vector2.Distance(hitObject.Position, destination) / (0.04 * RepulsionStrength.Value + 0.04); double dampLength = Vector2.Distance(hitObject.Position, cursorPos) / (0.04 * RepulsionStrength.Value + 0.04);
float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime); float x = (float)Interpolation.DampContinuously(hitObject.X, destination.X, dampLength, gameplayClock.ElapsedFrameTime);
float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime); float y = (float)Interpolation.DampContinuously(hitObject.Y, destination.Y, dampLength, gameplayClock.ElapsedFrameTime);