Near-Far interactor and GameObject Layer Issue

I am trying to setup Near-Far interactor to work with GameObject that have Game Object Layer set to some custom layer. (WeaponP)

If I change Layer from “Default” to “WeaponP” the near-far interactor stops working :frowning:
image

I also can set interaction masks with no issues, but as soon as Object Layer used for physics is changed it stops working (I also mapped WeaponP layer to the layer of the Left/Right Controller)

Any idea ? Or if someone can try to reproduce this ?

Thank you ?

You may wish to review the official docs for the Near-Far Interactor to see what role layers and layermasks play in the process via the Interaction Layer Mask property.

The difference between Layers vs LayerMasks:

“There are 10 types of people in this world: those who understand binary, and those who don’t.”

If you’re still struggling after reviewing the docs, try this formula to communicate complex technical issues in the forum:

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
  • links to actual Unity3D documentation you used to cross-check your work (CRITICAL!!!)

The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?

Thank you for your quick answer.

Unfortunately i did not find any info on GameObject Layers and Near-Far Interactors relations.

https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.0/manual/near-far-interactor.html

There is only info about Interaction Layer Mask. Which i think I fully understand how they work and how to set them up if needed.

I’ll try again tomorrow… its really late here 0:33 and i need to sleep :slight_smile:

FYI:

I could not sleep on it. I think i found the issue:
I did not set Curve Interactor Caster Raycast Mask:

After adding my Layer here it worked.

3 Likes

Glad you found the solution.

Indeed the nearfar interactor works via casters. The curve caster has its own layer masks, as does the sphere caster for near interaction. You’ll want to update both.

If you want global control, as was also mentioned in the thread you can also customize the interaction layer mask on the near far interactor itself.