October 15, 2019 update:
  • The Daydream View VR headset is no longer available for purchase. However, developers can continue to use the existing Google VR SDK to update and distribute their apps to the Google Play Store, and make them available to users in the Daydream app.

GvrTooltip

A tooltip for displaying control schemes overlaying the controller visual using a Unity Canvas.

Summary

Automatically changes what side of the controller the tooltip is shown on depending on the handedness setting for the player. Automatically fades out when the controller visual is too close or too far away from the player's head. Look at the prefab GvrControllerPointer to see an example of how to use this script.

Inheritance

Inherits from: MonoBehaviour, IGvrArmModelReceiver

Protected attributes

APP_BUTTON_Y_POSITION_METERS = 0.0105f
const float
Y position for app button tooltips based on the standard controller visual.
TOOLTIP_Z_POSITION_METERS = 0.0098f
const float
Z position for all tooltips based on the standard controller visual.
TOUCH_PAD_Y_POSITION_METERS = 0.0385f
const float
Y Position for touch pad tooltips based on the standard controller visual.

Protected static attributes

LEFT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 180.0f)
readonly Quaternion
Rotation for a tooltip when it is displayed on the left side of the controller visual.
PIVOT = new Vector2(-0.5f, 0.5f)
readonly Vector2
Pivot point for a tooltip, used for controlling what side the tooltip is on.
RIGHT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 0.0f)
readonly Quaternion
Rotation for a tooltip when it is displayed on the right side of the controller visual.
SQUARE_CENTER = new Vector2(0.5f, 0.5f)
readonly Vector2
Anchor point for a tooltip, used for controlling what side the tooltip is on.

Properties

ArmModel
Gets or sets the arm model reference.
TooltipText
Text
Gets the text field for this tooltip.

Public functions

IsTooltipInside()
bool
Returns true if this tooltip is set to display on the inside of the controller.
IsTooltipOnLeft()
bool
Returns true if the tooltip should display on the left side of the controller.

Protected functions

GetMetersToCanvasScale()
float
Gets the meters-to-canvas scale.
OnSideChanged(bool IsLocationOnLeft)
virtual void
Refreshes how the tooltip is being displayed based on what side it is being shown on.

Protected attributes

APP_BUTTON_Y_POSITION_METERS

const float APP_BUTTON_Y_POSITION_METERS = 0.0105f

Y position for app button tooltips based on the standard controller visual.

TOOLTIP_Z_POSITION_METERS

const float TOOLTIP_Z_POSITION_METERS = 0.0098f

Z position for all tooltips based on the standard controller visual.

TOUCH_PAD_Y_POSITION_METERS

const float TOUCH_PAD_Y_POSITION_METERS = 0.0385f

Y Position for touch pad tooltips based on the standard controller visual.

Protected static attributes

LEFT_SIDE_ROTATION

readonly Quaternion LEFT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 180.0f)

Rotation for a tooltip when it is displayed on the left side of the controller visual.

PIVOT

readonly Vector2 PIVOT = new Vector2(-0.5f, 0.5f)

Pivot point for a tooltip, used for controlling what side the tooltip is on.

RIGHT_SIDE_ROTATION

readonly Quaternion RIGHT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 0.0f)

Rotation for a tooltip when it is displayed on the right side of the controller visual.

SQUARE_CENTER

readonly Vector2 SQUARE_CENTER = new Vector2(0.5f, 0.5f)

Anchor point for a tooltip, used for controlling what side the tooltip is on.

Properties

ArmModel

GvrBaseArmModel ArmModel

Gets or sets the arm model reference.

The arm model reference.

TooltipText

Text TooltipText

Gets the text field for this tooltip.

The tooltip text.

Public functions

IsTooltipInside

bool IsTooltipInside()

Returns true if this tooltip is set to display on the inside of the controller.

Details
Returns
Returns true if this instance is tooltip inside; otherwise, false.

IsTooltipOnLeft

bool IsTooltipOnLeft()

Returns true if the tooltip should display on the left side of the controller.

This will change based on the handedness of the controller, as well as if the tooltip is set to display inside or outside.

Details
Returns
Returns true if this instance is tooltip on left; otherwise, false.

Protected functions

GetMetersToCanvasScale

float GetMetersToCanvasScale()

Gets the meters-to-canvas scale.

Details
Returns
The meters-to-canvas scale.

OnSideChanged

virtual void OnSideChanged(
  bool IsLocationOnLeft
)

Refreshes how the tooltip is being displayed based on what side it is being shown on.

Override to add custom display functionality.

Details
Parameters
IsLocationOnLeft
Whether the location is on the left.