I’m building a VR game using the Google VR SDK and designing navigation on a gaze based interaction (staring at a marker in space to trigger walk towards it).
I’ve managed to create a gaze navigation system that works fine, but I also want to introduce game objects that the player can interact with by gazing at them only when in close enough proximity.
I don’t want the raycast to hit the interactable object unless the player is close enough. I hoped this could be accomplished by putting all the interactable objects on a certain layer and somehow make the raycast ignore all objects on this layer unless the distance to the player (caster) is within a certain range.
I guess I could do this by adding a script to these objects that in the Update-method checks the distance to the player and then toggles it’s layer from “Ignore raycast” to “Default” if the distance is close enough, but I wonder that is a bad practise performance wise and maybe there are some better/more integrated way of doing this?