Detecting or ignoring internal faces on UnionOperations during raycasts

Hey all,

I’m running into an issue with raycasting against UnionOperation instances that use CollisionFidelity = PreciseConvexDecomposition.

When casting a ray (e.g., vertically through the part), the ray can hit internal faces that exist inside the union’s volume, not just the exterior surface.

Goal:
I want to detect only exterior surface hits and ignore any hits on internal faces within the union.

For example, with a C-shaped union using PreciseConvexDecomposition, raycasts return hits on faces that are completely inside the solid, not just on the outer boundary.

Is there a reliable way to determine whether a raycast hit position is on the exterior surface versus inside the union volume?

Hey! Your not crazy lol raycasts in Roblox only detect the first surface they hit and unfortunately there’s currently no built in way to tell the engine to ignore internal faces or surfaces inside a UnionOperation. Raycasting in Roblox works by testing against part collision surfaces and it doesn’t have backface detection or a flag to ignore internal geometry yet.

When you call workspace:Raycast(origin, direction, params) it checks for the first surface the ray intersects and returns that result. Internally, Roblox doesn’t differentiate front vs back faces or interior mesh surfaces it just intersects collision geometry.

You can refer here :
:link: Backface detection to raycasts
:link: https://create.roblox.com/docs/workspace/raycasting

This affects UnionOperation because unions often have complicated collision meshes and internal seams so EVEN if the surface looks solid in studio the collision geometry might actually have hidden interior faces where raycasts can hit first. That’s why your raycast might hit unexpected faces or seem to ignore what you expect. This is also something devs have talked about when handling raycasts that fire through parts you wouldn’t expect to.

You can try using CollisionGroups/Filtering or cast rays from both sides as a workaround