Spatial Touch behind collider

I have a thing that I want to touch/pinch that is behind “glass” aka a box collider with a transparent material. I want the eye tracking based pinch to ignore/go through the collider, but the object to collide with the “glass”. I’ve tried using the collision layers but it’s not working no matter what I try.

1 Like

Can you share a screenshot of your setup? If you have a collider inside a box collider that should resolve out of the collider and not collide internally with the bounds of the box. You might be able to create a box with 6 thin box colliders.

The Collider Objects Layermask in PolySpatial settings would be the correct way to solve this.

spatial touches are not going through the box on the default layer, the object I want to touch is not inside the collider, it’s just on the other side of one

i think that layerMask is borked… meanwhile you could aabb box detection on raycast and then disable collider when camera is there so that you can touch the ball?

wait, so raycast layerMasks do not work but there is some sort of polyspatial Layer mask?

I was able to get this setup working using a modified version of the template bounded scene.

  1. Create a new layer and set the glass / front collider object to that layer (I used IgnoreCollider)

  2. Make sure that object is NOT in the PolySpatial Collider Layer Mask

  3. Double check that your new layer and the object you want to grab can collide via the physics layer matrix (they should by default)

  4. Make sure your input isn’t just setting the objects position and instead driving the physics so that the object doesn’t pass through a physics object.

Here’s a video of it working (a bit hard to tell with the transparent object).


These should all work as expected but have different purposes. The challenge with input is that any collider in RealityKit will “catch” input so you can leverage the Collider Objects Layer Mask to not send collider data for certain objects. The colliders will exist in Unity and can still interact with other objects.

As Dan says, the Collider Objects Layer Mask setting is the best way to achieve this. Colliders whose GameObject layer does not match the Collider Objects Layer Mask (which, by default, contains only the Default layer) will not be transferred via PolySpatial and should not be returned in raycasting results. Note that the check happens when the GameObject is first encountered, so it won’t work if you change the layer after PolySpatial initializes.

If this doesn’t work for you, please submit a bug report with a repro case and let us know the incident number (IN-#####), so that we can investigate.