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.

GvrPointerPhysicsRaycaster

This script provides a raycaster for use with the GvrPointerInputModule.

Summary

It behaves similarly to the standards Physics raycaster, except that it utilize raycast modes specifically for Gvr.

View GvrBasePointerRaycaster.cs and GvrPointerInputModule.cs for more details.

Inheritance

Inherits from: GvrBasePointerRaycaster

Protected attributes

NO_EVENT_MASK_SET = -1
const int
Const to use for clarity when no event mask is set.
raycasterEventMask = NO_EVENT_MASK_SET
LayerMask
Layer mask used to filter events.

Properties

MaxRaycastHits
int
Gets or sets the maximum number of hits that the raycaster can detect at once.
eventCamera
override Camera
eventMask
LayerMask
Gets or sets the layer mask used to filter events.
finalEventMask
int
Gets the event mask used to determine which objects will receive events.

Protected functions

GvrPointerPhysicsRaycaster()
Initializes a new instance of the GvrPointerPhysicsRaycaster class.
PerformRaycast(GvrBasePointer.PointerRay pointerRay, float radius, PointerEventData eventData, List< RaycastResult > resultAppendList)
virtual override bool
Perform raycast on the scene.

Protected attributes

NO_EVENT_MASK_SET

const int NO_EVENT_MASK_SET = -1

Const to use for clarity when no event mask is set.

raycasterEventMask

LayerMask raycasterEventMask = NO_EVENT_MASK_SET

Layer mask used to filter events.

Always combined with the camera's culling mask if a camera is used.

Properties

MaxRaycastHits

int MaxRaycastHits

Gets or sets the maximum number of hits that the raycaster can detect at once.

They are NOT guaranteed to be ordered by distance. This value should be set to a higher number than the number of objects the pointer is expected to intersect with in a single frame.

This functionality is used to prevent unnecessary memory allocation to improve performance. https://docs.unity3d.com/ScriptReference/Physics.SphereCastNonAlloc.html.

The maximum number of hits that the raycaster can detect at once.

eventCamera

override Camera eventCamera

eventMask

LayerMask eventMask

Gets or sets the layer mask used to filter events.

Always combined with the camera's culling mask if a camera is used.

The layer mask used to filter events.

finalEventMask

int finalEventMask

Gets the event mask used to determine which objects will receive events.

The event mask used to determine which objects will receive events.

Protected functions

GvrPointerPhysicsRaycaster

 GvrPointerPhysicsRaycaster()

Initializes a new instance of the GvrPointerPhysicsRaycaster class.

PerformRaycast

virtual override bool PerformRaycast(
  GvrBasePointer.PointerRay pointerRay,
  float radius,
  PointerEventData eventData,
  List< RaycastResult > resultAppendList
)

Perform raycast on the scene.