Controller Support

Daydream offers motion controller support for Unity and Unreal. These features include:

  • Controller visualization: A 3D model of the Daydream controller that displays which button the user is currently pressing and where the user is currently touching the Daydream controller's touchpad.

  • Laser and reticle visualization: Displays a laser and reticle so the user can easily interact with the VR environment.

  • Arm model: A mathematical model to make the 3D controller model in VR approximate the physical location of the Daydream controller.

  • Input System: A standard and extensible framework for raycasting from the controller model. The input system integrates with the laser and reticle visualization to make it easy to interact with the UI and other objects in VR.

All visualization elements are optional and reskinnable.

Controller support in Unity

Daydream controller support in Unity is available through prefabs included with the GVR SDK for Unity.

Example

The steps below detail how to create a simple VR Unity app that demonstrates the 3D controller model, laser and reticle, and tooltips.

  1. Download and install Unity 5.6 or newer.
  2. Download the Google VR SDK for Unity.
  3. Create a new 3D Unity Project.
  4. Configure the build settings to enable Daydream support.
  5. Import the GVR SDK for Unity.
    1. Under the Assets menu, select Import Package, then Custom Package, then navigate to the Unity GVR SDK and select it.
  6. Enable support for the Daydream controller and UI.
    1. Create an empty GameObject and name it Player.
    2. Set the position of the Player object to (0,1.6,0).
    3. Place the Main Camera underneath the Player object at (0,0,0).
    4. Place GvrControllerPointer underneath the Player object at (0,0,0).
    5. Set the position of the Main Camera to be (0,0,0).
    6. Add GvrEditorEmulator to the scene, located under GoogleVR/Prefabs.
    7. Add GvrControllerMain to the scene, located under GoogleVR/Prefabs/Controller.
    8. Add GvrEventSystem to the scene, located under GoogleVR/Prefabs/UI.
  7. Save the scene.
  8. Open File > Build Settings. Add the current scene to the scene list and make sure it's the first scene enabled.
  9. Press Build & Run to run the example.

Controller visualization

Daydream provides a 3D model of the Daydream controller that displays which button the user is currently pressing and where the user is currently touching the Daydream controller's touchpad. The controller model is managed by the GvrControllerVisual.cs script. To access this script, add the GvrControllerPointer prefab to your scene, available under GoogleVR/Prefabs/UI, and click the triangle icon to view all the nested prefabs. The script is attached to ddController.

GvrControllerVisual.cs exposes a number of properties that let you customize the look and feel of the controller visualization.

Tooltips

Daydream provides a set of customizable tooltips for the Daydream controller model. The tooltips are controlled by four objects nested under the Tooltips prefab, available as part of GvrControllerPointer:

  • TouchPadOutside
  • TouchPadInside
  • AppButtonOutside
  • AppButtonInside

The four tooltip prefabs correspond to their locations relative to the controller and the given handedness settings. You can change the handedness setting by pressing the Change Handedness button in the Gvr Tooltip script component.

By default, the tooltips will only appear when the user is looking closely at the controller.

The Tooltip script also lets you customize the location, text, and context as to when the tooltips appear.

Laser and reticle visualization

The GvrLaserPointer script, available on the Laser prefab nested under GvrControllerPointer, controls the laser visualization. The laser lets users locate their cursor when it's not directly in their field of view. The GvrLaserPointer script has the following settings:

  • Laser Color: Determines the color of the laser.
  • Max Laser Distance: When you're not currently pointing at an object, this is the maximum distance in meters that the laser will render.
  • Max Reticle Distance: When you're not currently pointing at an object, this is the maximum distance in meters that the laser reticle will render.

Arm model

Daydream provides an arm model, a mathematical model that uses the orientation and location of the physical controller, and predicts the location of the shoulder, elbow, wrist, and pointer to determine where to place the controller model within the scene.

The arm model is controlled through the GvrArmModel script, which is attached to the provided prefab GvrControllerMain.

The GvrArmModel script allows you to adjust the following properties:

  • Added Elbow Height: Adds an offset to the predicted elbow height.
  • Added Elbow Depth: Adds an offset to the predicted elbow depth.
  • Pointer Tilt Angle: Downward tilt of the laser pointer relative to the controller in degrees. The default value of 15° is optimized for ergonomic comfort when interacting with objects at eye level. If the user needs to interact with objects significantly higher or lower than they are, you may need to adjust this property.
  • Fade Distance From Face: Controller distance from face after which the alpha value decreases.
  • Follow Gaze: Determines if the shoulder should follow the user's gaze.
  • Use Accelerometer: Turning the accelerator off makes the controller feel more precise and predictable. Turning it on reduces precision but can make the user feel more like they're holding a real object.

Input system

Daydream provides an extension of Unity's event system that optimizes working with the Daydream controller. To make use of this system, add the GvrEventSystem prefab to your scene. You can configure the Input System through the GvrPointerInputModule script attached to this prefab.