Improves sprite click detection (#3480)
* Improves sprite click detection. * F
This commit is contained in:
committed by
GitHub
parent
23d96c4404
commit
abdee3d4ee
@@ -89,7 +89,17 @@ namespace Content.Client.GameObjects.Components
|
||||
|
||||
var layerPos = modAngle.RotateVec(localPos);
|
||||
|
||||
var localOffset = layerPos * EyeManager.PixelsPerMeter * (1, -1);
|
||||
var localOffset = layerPos * EyeManager.PixelsPerMeter;
|
||||
|
||||
localOffset *= layer.DirOffset switch
|
||||
{
|
||||
SpriteComponent.DirectionOffset.None => (1, -1),
|
||||
SpriteComponent.DirectionOffset.Clockwise => (-1, -1),
|
||||
SpriteComponent.DirectionOffset.CounterClockwise => (1, 1),
|
||||
SpriteComponent.DirectionOffset.Flip => (-1, 1),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
|
||||
if (layer.Texture != null)
|
||||
{
|
||||
if (_clickMapManager.IsOccluding(layer.Texture,
|
||||
@@ -108,6 +118,10 @@ namespace Content.Client.GameObjects.Components
|
||||
}
|
||||
|
||||
var (mX, mY) = localOffset + rsi.Size / 2;
|
||||
(mX, mY) = layer.DirOffset == SpriteComponent.DirectionOffset.Clockwise ||
|
||||
layer.DirOffset == SpriteComponent.DirectionOffset.CounterClockwise
|
||||
? (mY, mX)
|
||||
: (mX, mY);
|
||||
|
||||
if (_clickMapManager.IsOccluding(rsi, layer.RsiState, dir,
|
||||
layer.AnimationFrame, ((int) mX, (int) mY)))
|
||||
|
||||
Reference in New Issue
Block a user