Surface Gui input and hover detection is offset

The issue is simple. There is a very slight offset of all input on a surface gui. Buttons will hover when your mouse is well above it and not when it’s directly on it. Now, important note, this is a very slight offset, however, there is a situation where this offset becomes very problematic. This offset seems to be stud-based, not pixel-based, so this issue can become very large on small surface guis. All you need to do is create a part that is very small but close to the camera so that it doesn’t appear small (but still is) and try to hover or click on buttons on it. You may think that it is a non-issue as you will “never need a surface gui this small” however, my game uses this. A common trick used to prevent viewmodel clipping in first person games is scaling down the viewmodel to fit into your hitbox. Since it scales around the camera and is projected to 2d when displayed on your screen, it does not seem small, but doesn’t clip into its surroundings. This will cause large issues if the player needs to interact with something, say, a phone, on a viewmodel of this sort.

I have devised a straightforward test place that demonstrates the issue as well as this “viewmodel trick” I was mentioning. It features two parts with surface guis, one being 3.7x1.8 studs, the other being 0.12x0.06 studs. The larger part’s surface gui’s offset issue is unnoticeable due to its size, but the small part’s issue is very noticeable. These parts are scaled around the camera, so they appear the same while being different sizes. You can see the size difference in studio, or by looking at the billboard I put above it, displaying its size. Simply go into play mode, look at the small gui or the large gui, and try to hover over the buttons. You’ll know that it detected its hover as the autobutton color property will make the button darker.

Images:
Hovering when it shouldn’t
image
Not hovering when it should
image

Demo Place
Surface Gui Offset Bug Demo.rbxl (65.1 KB)

System Info:
OS: Windows 11 Home 64-bit (10.0, Build 22631)
Processor: AMD Ryzen 7 5800X 8-Core Processor (16 CPUs), ~3.8 GHz
Memory: 32768MB RAM
Display 1 Name: Radeon RX 5500 XT

Expected behavior

If things were working correctly, surface GUI buttons should hover and detect clicks correctly on all scales of surface GUI and function like the large example in the demo place.

3 Likes

In order to fix this issue in my game, I wrote my own code to detect clicks and used that instead of roblox’s built in system, which should not be necessary. Since I just now got the @allowbugreports group, I decided to make a post on it.

2 Likes

Edit: It appears this problem may be exacerbated by canvas groups? I may need to test this further.