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 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.

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.

Properties

ArmModel
TooltipText
Text
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
OnSideChanged(bool IsLocationOnLeft)
virtual void
Refreshes how the tooltip is being displayed based on what side it is being shown on.

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.

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.

Properties

ArmModel

GvrBaseArmModel ArmModel

TooltipText

Text TooltipText

The text field for this tooltip.

Public functions

IsTooltipInside

bool IsTooltipInside()

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

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.

Protected functions

GetMetersToCanvasScale

float GetMetersToCanvasScale()

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.