Raycast

VIVE Wave™ XR plugin provides the Raycast feature used to interaction with scene objects with Gaze / Controller / Hand in the Essence package (refer to Wave XR Plugin Packages).

Sample

The Raycast sample is located at Assets > Samples > Wave > Essence > Essence > Raycast.

The Raycast feature contains four parts: Raycast Switch, Gaze Raycast Ring, Controller Raycast Pointer and Hand Raycast Pointer..

Note

Before using the Raycast feature, you have to enable Simultaneous Interaction from menu item Wave > Interaction Mode > Enable Simultaneous Interaction.

Raycast Switch

The RaycastSwitch component is used to control GazeRaycastRing, ControllerRaycastPointer and HandRaycastPointer.

You can use the following code to enable or disable these three components.

RaycastSwitch.Gaze.Enabled = true;       // enable GazeRaycastRing
RaycastSwitch.Controller.Enabled = true; // enable ControllerRaycastPointer
RaycastSwitch.Hand.Enabled = true;       // enable HandRaycastPointer

Gaze Raycast Ring

The GazeRaycastRing component should be put under the scene Main Camera.

Create a empty GameObject named “Pointer” and add the GazeRaycastRing then you can see the settings as below.

../_images/014.png ../_images/024.png

Physics Raycaster Settings: Refer to PhysicsRaycaster.

Ring Settings: For configuring the gaze ring’s layout.

Gaze Settings: For configuring the gaze timer, event and control keys (when using controllers).

Always Enable: If enabled, the setting of Raycast Switch will be ignored.

Controller Raycast Pointer

The ControllerRaycastPointer should be added to your controller which applies poses.

../_images/034.png

After added the ControllerRaycastPointer, you need to configure the Ray Material and Pointer.

In the sample, we used the Unity Default-Line as the Ray Material.

You can refer to Line Renderer for customizing the controller ray.

About the Pointer, we simply created a GameObject, added an Image and used the Unity Knob as the Source Image.

../_images/043.png ../_images/054.png

Physics Raycaster Settings: Refer to PhysicsRaycaster.

Controller Settings: For configuring the controller type and control keys.

Hide When Idle: To hide the controller raycast pointer when the controller is idle.

Always Enable: If enabled, the setting of Raycast Switch will be ignored.

Hand Raycast Pointer

The GameObject with HandRaycastPointer should be in the same layer with your hand model which applies poses.

../_images/063.png ../_images/073.png

After added the HandRaycastPointer, you need to configure the Ray Material and Pointer.

In the sample, we used the Unity Default-Line as the Ray Material.

You can refer to Line Renderer for customizing the hand ray.

About the Pointer, we simply created a GameObject, added an Image and used the Unity Knob as the Source Image.

../_images/082.png ../_images/054.png

Physics Raycaster Settings: Refer to PhysicsRaycaster.

Hand Settings: For configuring the hand type, using hand pinch data (refer to Hand Tracking Reference Guide) or not and the pinch strength.

The HandRaycastPointer uses the Pinch motion as the trigger action. When pinching, the HandRaycastPointer will send interaction events to the object which is raycasted.

The Pinch motion is judged by the Pinch Strength.

Always Enable: If enabled, the setting of Raycast Switch will be ignored.