GvrVRHelpers

Helper functions common to GVR VR applications.

Summary

Public static functions

GetHeadForward()
Vector3
Gets the forward vector relative to the headset's rotation.
GetHeadPosition()
Vector3
Gets the head's position.
GetHeadRotation()
Quaternion
Gets the headset's rotation.
GetRayIntersection(GvrBasePointer.RaycastMode mode)
float
Gets the distance at which the Direct and Camera raycasts intersect.
GetRecommendedMaxLaserDistance(GvrBasePointer.RaycastMode mode)
float
Gets the recommended max laser distance, based on raycast mode.
GetShrinkLaser(GvrBasePointer.RaycastMode mode)
bool
Returns a value indicating whether the laser is visually shrunken.
GetViewportCenter()
Vector2
Gets the center of the screen or eye texture, in pixels.

Public static functions

GetHeadForward

Vector3 GetHeadForward()

Gets the forward vector relative to the headset's rotation.

Details
Returns
The forward vector relative to the headset's rotation.

GetHeadPosition

Vector3 GetHeadPosition()

Gets the head's position.

Details
Returns
The head's position.

GetHeadRotation

Quaternion GetHeadRotation()

Gets the headset's rotation.

Details
Returns
The headset's rotation.

GetRayIntersection

float GetRayIntersection(
  GvrBasePointer.RaycastMode mode
)

Gets the distance at which the Direct and Camera raycasts intersect.

This is the point at which Hybrid mode will transition from Direct (closer than the intersection) to Camera (further than the intersection) mode.

Details
Parameters
mode
The RaycastMode for which to get the intersection distance. Only returns non-zero when this is RaycastMode.Camera.
Returns
The distance at which the Direct and Camera raycasts intersect.

GetRecommendedMaxLaserDistance

float GetRecommendedMaxLaserDistance(
  GvrBasePointer.RaycastMode mode
)

Gets the recommended max laser distance, based on raycast mode.

Details
Parameters
mode
The RaycastMode for which to get the recommended distance.
Returns
The recommended maximum laser distance for the given mode.

GetShrinkLaser

bool GetShrinkLaser(
  GvrBasePointer.RaycastMode mode
)

Returns a value indicating whether the laser is visually shrunken.

Details
Parameters
mode
The RaycastMode for which to check behavior.
Returns
Returns true if the laser is shrunken, falsea otherwise.

GetViewportCenter

Vector2 GetViewportCenter()

Gets the center of the screen or eye texture, in pixels.

Details
Returns
The center of the screen, in pixels.