I have a question regarding Unity VR and Interaction Toolkit.
When I point at a UI canvas element, the raycast turns from red to white (indicating that it is a valid target). However, when I create a plane or terrain, assign a custom layer to it and include the custom layer in the Raycast Mask, the raycast will remain red upon pointing on the plane/terrain (indicating an invalid target).
I don't know how to fix this problem. Any suggestions?
I created an empty plane which the user should be able to teleport on. I assigned the custom layer "test" to it. I have the XR Interaction Toolkit installed. For the right and lefthand controller I added the layer "test" to the Raycast mask (The Layer UI is included there as well, I have no issues with the UI canvas however). When I point at the plane I can teleport successfully, the raycast remains red however, which shouldnt be the case, since the layer "test" is in the Raycast mask.
The issue remains, even when I deactivate my teleportation script!!!! So whenever I point at the plane with the custom layer, the line remains red.
Teleportation:
if (rayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit hit))
{
if (((currentTeleportationLayer.value & (1 << hit.collider.gameObject.layer)) > 0 ||
(middleTeleportationLayer.value & (1 << hit.collider.gameObject.layer)) > 0) /* &&
allowedToMove*/)
{
PerformTeleportation(hit.point);
}
}
rayInteractor.enabled = false;