From 77fd7480352b3dbc834fe7fa85b01d17491466c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 6 Mar 2020 21:21:20 +0100 Subject: [PATCH] Fix incorrect circle piece hitbox Hitboxes of circle pieces in osu! have regressed with commit 8592335. The reason for the regression was that hit detection was moved from DrawableHitCircle itself to a newly-introduced private HitArea class (now named HitReceptor). As HitArea inherited from Drawable, it would return IsHovered == true over its entire bounding box. This meant that the hit area could wrongly pick up actions that are not within circle radius and make them into hits. To resolve, make HitReceptor a CompositeDrawable and set its corner radius to match the circle piece. This fixes the invalid hitbox, as IsHovered takes radius into account. --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 4ef63bb2a0..da1e666aba 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public Drawable ProxiedLayer => ApproachCircle; - public class HitReceptor : Drawable, IKeyBindingHandler + public class HitReceptor : CompositeDrawable, IKeyBindingHandler { // IsHovered is used public override bool HandlePositionalInput => true; @@ -185,6 +185,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Anchor = Anchor.Centre; Origin = Anchor.Centre; + + CornerRadius = OsuHitObject.OBJECT_RADIUS; + CornerExponent = 2; } public bool OnPressed(OsuAction action)