Potential issue in calculating SurfaceGui distance

The SurfaceGui.MaxDistance property is supposed to hide the SurfaceGui if the distance from the camera to the closest point on the SurfaceGui is greater than SurfaceGui.MaxDistance:

However it appears that the closest point on the surface is clamped to the smallest of the face’s two axes. This is apparent with a really long part with a relatively small MaxDistance. Take for example this part, my camera is within 50 studs of the closest point on the top face (on which the ScreenGui.Face is), however the frame inside of the SurfaceGui is not visible:

It’s only when we go within 50 studs of a supposed 4x4 square at the origin that the frame is visible (move handles to show where the part’s origin is):

Here’s an example place with the SurfaceGui in question:
surfaceGuiIssue.rbxl (57.5 KB)

Specs:
AMD Ryzen 7 7800X3D @ 4.20GHz
NVIDIA GeForce RTX 4080
32.0GB DDR5 RAM @ 5200MHz

3 Likes