diff --git a/Content.Client/Singularity/SingularityOverlay.cs b/Content.Client/Singularity/SingularityOverlay.cs index c7c6aa2b5b..e71b6e96b8 100644 --- a/Content.Client/Singularity/SingularityOverlay.cs +++ b/Content.Client/Singularity/SingularityOverlay.cs @@ -100,6 +100,8 @@ namespace Content.Client.Singularity /// private void OnProjectFromScreenToMap(ref PixelToMapEvent args) { // Mostly copypasta from the singularity shader. + if (args.Viewport.Eye == null) + return; var maxDistance = MaxDistance * EyeManager.PixelsPerMeter; var finalCoords = args.VisiblePosition; @@ -112,10 +114,11 @@ namespace Content.Client.Singularity // and in local space 'Y' is measured in pixels from the top of the viewport. // As a minor optimization the locations of the singularities are transformed into fragment space in BeforeDraw so the shader doesn't need to. // We need to undo that here or this will transform the cursor position as if the singularities were mirrored vertically relative to the center of the viewport. + var localPosition = _positions[i]; localPosition.Y = args.Viewport.Size.Y - localPosition.Y; var delta = args.VisiblePosition - localPosition; - var distance = (delta / args.Viewport.RenderScale).Length(); + var distance = (delta / (args.Viewport.RenderScale * args.Viewport.Eye.Scale)).Length(); var deformation = _intensities[i] / MathF.Pow(distance, _falloffPowers[i]);