raycasting – Pink raycast regardless of legitimate goal in Unity VR

raycasting – Pink raycast regardless of legitimate goal in Unity VR

[ad_1]

I’ve a query concerning Unity VR and Interplay Toolkit.

After I level at a UI canvas factor, the raycast turns from crimson to white (indicating that it’s a legitimate goal). Nonetheless, once I create a airplane or terrain, assign a customized layer to it and embody the customized layer within the Raycast Masks, the raycast will stay crimson upon pointing on the airplane/terrain (indicating an invalid goal).

I do not know how one can repair this downside. Any ideas?

EDIT FOR MORE INFORMATION:

I created an empty airplane which the person ought to be capable to teleport on. I assigned the customized layer “take a look at” to it. I’ve the XR Interplay Toolkit put in. For the correct and lefthand controller I added the layer “take a look at” to the Raycast masks (The Layer UI is included there as nicely, I’ve no points with the UI canvas nevertheless). After I level on the airplane I can teleport efficiently, the raycast stays crimson nevertheless, which shouldnt be the case, for the reason that layer “take a look at” is within the Raycast masks.

The difficulty stays, even once I deactivate my teleportation script!!!! So at any time when I level on the airplane with the customized layer, the road stays crimson.

Teleportation:

        if (rayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit hit))
        {
           
            if (((currentTeleportationLayer.worth & (1 << hit.collider.gameObject.layer)) > 0 ||
                 (middleTeleportationLayer.worth & (1 << hit.collider.gameObject.layer)) > 0) /* &&
                allowedToMove*/)
            {
                PerformTeleportation(hit.level);
            }
        }
        rayInteractor.enabled = false;
```

[ad_2]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply