mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Take circle radius into account when clamping hit objects to playfield
This commit is contained in:
parent
f5134c7fc2
commit
cca26d4651
@ -66,6 +66,11 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
private const byte border_distance_x = 192;
|
private const byte border_distance_x = 192;
|
||||||
private const byte border_distance_y = 144;
|
private const byte border_distance_y = 144;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The extent of rotation towards playfield centre when a circle is near the edge
|
||||||
|
/// </summary>
|
||||||
|
private const float edge_rotation_multiplier = 0.75f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Duration of the undimming animation
|
/// Duration of the undimming animation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -295,14 +300,16 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
var newPosition = Vector2.Add(lastPos, relativePos);
|
var newPosition = Vector2.Add(lastPos, relativePos);
|
||||||
|
|
||||||
if (newPosition.Y < 0)
|
var radius = (float)obj.Radius;
|
||||||
newPosition.Y = 0;
|
|
||||||
else if (newPosition.Y > OsuPlayfield.BASE_SIZE.Y)
|
if (newPosition.Y < radius)
|
||||||
newPosition.Y = OsuPlayfield.BASE_SIZE.Y;
|
newPosition.Y = radius;
|
||||||
if (newPosition.X < 0)
|
else if (newPosition.Y > OsuPlayfield.BASE_SIZE.Y - radius)
|
||||||
newPosition.X = 0;
|
newPosition.Y = OsuPlayfield.BASE_SIZE.Y - radius;
|
||||||
else if (newPosition.X > OsuPlayfield.BASE_SIZE.X)
|
if (newPosition.X < radius)
|
||||||
newPosition.X = OsuPlayfield.BASE_SIZE.X;
|
newPosition.X = radius;
|
||||||
|
else if (newPosition.X > OsuPlayfield.BASE_SIZE.X - radius)
|
||||||
|
newPosition.X = OsuPlayfield.BASE_SIZE.X - radius;
|
||||||
|
|
||||||
obj.Position = newPosition;
|
obj.Position = newPosition;
|
||||||
|
|
||||||
@ -390,7 +397,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
return rotateVectorTowardsVector(
|
return rotateVectorTowardsVector(
|
||||||
posRelativeToPrev,
|
posRelativeToPrev,
|
||||||
Vector2.Subtract(playfieldMiddle, prevPosChanged),
|
Vector2.Subtract(playfieldMiddle, prevPosChanged),
|
||||||
Math.Min(1, relativeRotationDistance * 0.75f)
|
Math.Min(1, relativeRotationDistance * edge_rotation_multiplier)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user