November 6, 2019 update:
  • There's a new open source Cardboard SDK for iOS and Android NDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR code scanning. A corresponding Unity package (SDK) is planned for a future release. We recommend that all developers actively building for Google Cardboard migrate (iOS, Android NDK) to the new Cardboard SDK.
October 15, 2019 update:
  • The Daydream View VR headset is no longer available for purchase. However, you can continue to use the existing Google VR SDK to update and distribute your apps to the Google Play Store, and make them available to users in the Daydream app.

GvrLaserPointer

Implementation of GvrBasePointer for a laser pointer visual.

Summary

This script should be attached to the controller object. The laser visual is important to help users locate their cursor when its not directly in their field of view.

Inheritance

Inherits from: GvrBasePointer

Public attributes

defaultReticleDistance = 20.0f
float
Distance from the pointer that the reticle will be drawn at when hitting nothing.
maxPointerDistance = 20.0f
float
Maximum distance from the pointer that raycast hits will be detected.
overrideCameraRayIntersectionDistance
float
By default, the length of the laser is used as the CameraRayIntersectionDistance.

Properties

CameraRayIntersectionDistance
override float
LaserVisual
Gets the visual object for the laser beam.
MaxPointerDistance
override float

Public functions

GetPointerRadius(out float enterRadius, out float exitRadius)
virtual override void
Return the radius of the pointer.
OnPointerClickDown()
virtual override void
Called when a click is initiated.
OnPointerClickUp()
virtual override void
Called when click is finished.
OnPointerEnter(RaycastResult raycastResult, bool isInteractive)
virtual override void
Called when the pointer is facing a valid GameObject.
OnPointerExit(GameObject previousObject)
virtual override void
Called when the pointer no longer faces an object previously intersected with a ray projected from the camera.
OnPointerHover(RaycastResult raycastResult, bool isInteractive)
virtual override void
Called every frame the user is still pointing at a valid GameObject.

Public attributes

defaultReticleDistance

float defaultReticleDistance = 20.0f

Distance from the pointer that the reticle will be drawn at when hitting nothing.

maxPointerDistance

float maxPointerDistance = 20.0f

Maximum distance from the pointer that raycast hits will be detected.

overrideCameraRayIntersectionDistance

float overrideCameraRayIntersectionDistance

By default, the length of the laser is used as the CameraRayIntersectionDistance.

Set this field to a non-zero value to override it.

Properties

CameraRayIntersectionDistance

override float CameraRayIntersectionDistance

LaserVisual

GvrLaserVisual LaserVisual

Gets the visual object for the laser beam.

The visual object for the laser beam.

MaxPointerDistance

override float MaxPointerDistance

Public functions

GetPointerRadius

virtual override void GetPointerRadius(
  out float enterRadius,
  out float exitRadius
)

Return the radius of the pointer.

OnPointerClickDown

virtual override void OnPointerClickDown()

Called when a click is initiated.

OnPointerClickUp

virtual override void OnPointerClickUp()

Called when click is finished.

OnPointerEnter

virtual override void OnPointerEnter(
  RaycastResult raycastResult,
  bool isInteractive
)

Called when the pointer is facing a valid GameObject.

OnPointerExit

virtual override void OnPointerExit(
  GameObject previousObject
)

Called when the pointer no longer faces an object previously intersected with a ray projected from the camera.

OnPointerHover

virtual override void OnPointerHover(
  RaycastResult raycastResult,
  bool isInteractive
)

Called every frame the user is still pointing at a valid GameObject.