This site has been permanently archived. The content on this site was last updated in 2019.
Stay organized with collections
Save and categorize content based on your preferences.
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.
|
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
Protected static attributes
Properties
Public functions
Protected functions
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[null,null,["Last updated 2024-10-09 UTC."],[[["\u003cp\u003eGvrTooltip is a Unity Canvas-based tooltip for displaying VR controller control schemes.\u003c/p\u003e\n"],["\u003cp\u003eIt automatically adjusts the tooltip's position based on the controller's handedness and distance from the player's head.\u003c/p\u003e\n"],["\u003cp\u003eIt provides properties and functions to customize the tooltip's appearance and behavior.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use the provided prefab GvrControllerPointer as a reference for implementation.\u003c/p\u003e\n"]]],["The `GvrTooltip` script displays control scheme tooltips on a Unity Canvas, overlaying the controller visual. Key actions include: automatically adjusting the tooltip's display side based on player handedness, and fading out when the controller is too close or far from the player's head. The script provides protected attributes for positioning (Y and Z coordinates) and rotations for left/right sides, along with pivot and anchor points. It also include functions for determining if the tooltip is inside/left and updating display based on the side.\n"],null,["# GvrTooltip Class Reference\n\nGvrTooltip\n==========\n\nA tooltip for displaying control schemes overlaying the controller visual using a Unity Canvas.\n\nSummary\n-------\n\nAutomatically 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.\n\n### Inheritance\n\nInherits from: MonoBehaviour, [IGvrArmModelReceiver](/vr/reference/unity/interface/IGvrArmModelReceiver)\n\n| ### Protected attributes ||\n|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [APP_BUTTON_Y_POSITION_METERS](#classGvrTooltip_1aede5625fcdbf2691234f0fe375ee32b1)` = 0.0105f` | `const float` Y position for app button tooltips based on the standard controller visual. |\n| [TOOLTIP_Z_POSITION_METERS](#classGvrTooltip_1acffaa3e1b83db50796da3d19ee707689)` = 0.0098f` | `const float` Z position for all tooltips based on the standard controller visual. |\n| [TOUCH_PAD_Y_POSITION_METERS](#classGvrTooltip_1a2b380f7cecf6e11fc506652ed64af305)` = 0.0385f` | `const float` Y Position for touch pad tooltips based on the standard controller visual. |\n\n| ### Protected static attributes ||\n|--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| [LEFT_SIDE_ROTATION](#classGvrTooltip_1af3bde12c418672a6f9d224cf6ad401cc)` = 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. |\n| [PIVOT](#classGvrTooltip_1ac9b7de474e1b4c9bf21f84b0b9523877)` = new Vector2(-0.5f, 0.5f)` | `readonly Vector2` Pivot point for a tooltip, used for controlling what side the tooltip is on. |\n| [RIGHT_SIDE_ROTATION](#classGvrTooltip_1acbc4058d0b7cde01234ed9c39a616667)` = 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. |\n| [SQUARE_CENTER](#classGvrTooltip_1a9bc71a2e687a147621fb3d0b58a7c7a4)` = new Vector2(0.5f, 0.5f)` | `readonly Vector2` Anchor point for a tooltip, used for controlling what side the tooltip is on. |\n\n| ### Properties ||\n|--------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| [ArmModel](#classGvrTooltip_1abfe4669e7079718170d1d04e55481287) | [GvrBaseArmModel](/vr/reference/unity/class/GvrBaseArmModel#classGvrBaseArmModel) Gets or sets the arm model reference. |\n| [TooltipText](#classGvrTooltip_1aeb00a85bee77649609392b53b1e3059a) | `Text` Gets the text field for this tooltip. |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------|\n| [IsTooltipInside](#classGvrTooltip_1ac5cb820a741b0bbf16c519c62089c221)`()` | `bool` Returns `true` if this tooltip is set to display on the inside of the controller. |\n| [IsTooltipOnLeft](#classGvrTooltip_1ae98ab7ca693cd9819734032f357d6071)`()` | `bool` Returns `true` if the tooltip should display on the left side of the controller. |\n\n| ### Protected functions ||\n|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|\n| [GetMetersToCanvasScale](#classGvrTooltip_1a67a3cfe4a3d446ccbdb44962a4a54219)`()` | `float` Gets the meters-to-canvas scale. |\n| [OnSideChanged](#classGvrTooltip_1a6d1e6b85fccf9022935aeb991a739637)`(bool IsLocationOnLeft)` | `virtual void` Refreshes how the tooltip is being displayed based on what side it is being shown on. |\n\nProtected attributes\n--------------------\n\n### APP_BUTTON_Y_POSITION_METERS\n\n```c#\nconst float APP_BUTTON_Y_POSITION_METERS = 0.0105f\n``` \nY position for app button tooltips based on the standard controller visual. \n\n### TOOLTIP_Z_POSITION_METERS\n\n```c#\nconst float TOOLTIP_Z_POSITION_METERS = 0.0098f\n``` \nZ position for all tooltips based on the standard controller visual. \n\n### TOUCH_PAD_Y_POSITION_METERS\n\n```c#\nconst float TOUCH_PAD_Y_POSITION_METERS = 0.0385f\n``` \nY Position for touch pad tooltips based on the standard controller visual.\n\nProtected static attributes\n---------------------------\n\n### LEFT_SIDE_ROTATION\n\n```c#\nreadonly Quaternion LEFT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 180.0f)\n``` \nRotation for a tooltip when it is displayed on the left side of the controller visual. \n\n### PIVOT\n\n```c#\nreadonly Vector2 PIVOT = new Vector2(-0.5f, 0.5f)\n``` \nPivot point for a tooltip, used for controlling what side the tooltip is on. \n\n### RIGHT_SIDE_ROTATION\n\n```c#\nreadonly Quaternion RIGHT_SIDE_ROTATION = Quaternion.Euler(0.0f, 0.0f, 0.0f)\n``` \nRotation for a tooltip when it is displayed on the right side of the controller visual. \n\n### SQUARE_CENTER\n\n```c#\nreadonly Vector2 SQUARE_CENTER = new Vector2(0.5f, 0.5f)\n``` \nAnchor point for a tooltip, used for controlling what side the tooltip is on.\n\nProperties\n----------\n\n### ArmModel\n\n```c#\nGvrBaseArmModel ArmModel\n``` \nGets or sets the arm model reference.\n\nThe arm model reference. \n\n### TooltipText\n\n```c#\nText TooltipText\n``` \nGets the text field for this tooltip.\n\nThe tooltip text.\n\nPublic functions\n----------------\n\n### IsTooltipInside\n\n```c#\nbool IsTooltipInside()\n``` \nReturns `true` if this tooltip is set to display on the inside of the controller.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|------------------------------------------------------------------------|\n| **Returns** | Returns `true` if this instance is tooltip inside; otherwise, `false`. |\n\n### IsTooltipOnLeft\n\n```c#\nbool IsTooltipOnLeft()\n``` \nReturns `true` if the tooltip should display on the left side of the controller.\n\nThis will change based on the handedness of the controller, as well as if the tooltip is set to display inside or outside.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|-------------------------------------------------------------------------|\n| **Returns** | Returns `true` if this instance is tooltip on left; otherwise, `false`. |\n\nProtected functions\n-------------------\n\n### GetMetersToCanvasScale\n\n```c#\nfloat GetMetersToCanvasScale()\n``` \nGets the meters-to-canvas scale.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|-----------------------------|\n| **Returns** | The meters-to-canvas scale. |\n\n### OnSideChanged\n\n```c#\nvirtual void OnSideChanged(\n bool IsLocationOnLeft\n)\n``` \nRefreshes how the tooltip is being displayed based on what side it is being shown on.\n\nOverride to add custom display functionality.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |--------------------|--------------------------------------| | `IsLocationOnLeft` | Whether the location is on the left. | |"]]