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/033.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/042.png ../_images/053.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/064.png ../_images/074.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/083.png ../_images/053.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.

Interactive Area Settings: Used to control the area where hand pinch can take effect.

The area is a rectangle presented in (x, y) which x is a float (0~1) value presenting the horizontal range, where 0 means the left side and 1 means the right side of the rectangle, and y is a float (0~1) value presenting the vertical range, where 0 means the bottom and 1 means the top of the rectangle.
  • Enable Pinch Area: Select to enable the pinch area.
  • Left Interactive: A float (0 ~ 0.5) value defines the left boundary of the interactive area.
  • Right Interactive: A float (0.5 ~ 1) value defines the right boundary of the interactive area.
  • Top Interactive: A float (0.5 ~ 1) value defines the top boundary of the interactive area.
  • Bottom Interactive: A float (0 ~ 0.5) value defines the bottom boundary of the interactive area.

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