{"_id":"5b1f8576c2505d00031254a3","category":{"_id":"5b1f8576c2505d0003125425","version":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-31T16:56:01.612Z","from_sync":false,"order":1,"slug":"prefabs","title":"Prefabs"},"parentDoc":null,"user":"571fa519db52d01700f5cf3d","project":"571fa55ca0acd42000af9545","version":{"_id":"5b1f8576c2505d00031254db","project":"571fa55ca0acd42000af9545","__v":4,"forked_from":"594949e52be16d0026ec04cd","createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["5b1f8576c2505d0003125424","5b1f8576c2505d0003125425","5b1f8576c2505d0003125426","5b1f8576c2505d0003125427","5b1f8576c2505d0003125428","5b1f8576c2505d0003125429","5b1f8576c2505d000312542a","5b1f8576c2505d000312542b","5b1f8576c2505d000312542c","5b1f8576c2505d000312542d","5b1f8576c2505d000312542e","5b1f8576c2505d000312542f","5b1f8576c2505d0003125430","5b1f8576c2505d0003125431","5b1f8576c2505d0003125432","5b1f8576c2505d0003125433","5b1f8576c2505d0003125434","5b1f8576c2505d0003125435","5b1f8576c2505d0003125436","5b1f8576c2505d0003125437","5b1f8576c2505d0003125438","5b1f8aab9c683000032979e7","5b1f8b2f3073470003ffa5da","5b1f8bd9fd653400031d94f4","5b1f900bd4c5f000036b57bd"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Mangalica","version_clean":"3.3.0","version":"3.3.0"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-31T17:35:55.593Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"## Overview\n\nProvides a UI element into the world space that can be dropped into a Controller GameObject and used to create and use Radial Menus from the touchpad.\n\n**Prefab Usage:**\n * Place the `VRTK/Prefabs/RadialMenu/RadialMenu` prefab as a child of a Controller script alias GameObject.\n\n## Inspector Parameters\n\n * **Buttons:** An array of Buttons that define the interactive buttons required to be displayed as part of the radial menu.\n * **Button Prefab:** The base for each button in the menu, by default set to a dynamic circle arc that will fill up a portion of the menu.\n * **Generate On Awake:** If checked, then the buttons will be auto generated on awake.\n * **Button Thickness:** Percentage of the menu the buttons should fill, 1.0 is a pie slice, 0.1 is a thin ring.\n * **Button Color:** The background colour of the buttons, default is white.\n * **Offset Distance:** The distance the buttons should move away from the centre. This creates space between the individual buttons.\n * **Offset Rotation:** The additional rotation of the Radial Menu.\n * **Rotate Icons:** Whether button icons should rotate according to their arc or be vertical compared to the controller.\n * **Icon Margin:** The margin in pixels that the icon should keep within the button.\n * **Is Shown:** Whether the buttons are shown\n * **Hide On Release:** Whether the buttons should be visible when not in use.\n * **Execute On Unclick:** Whether the button action should happen when the button is released, as opposed to happening immediately when the button is pressed.\n * **Base Haptic Strength:** The base strength of the haptic pulses when the selected button is changed, or a button is pressed. Set to zero to disable.\n * **Dead Zone:** The dead zone in the middle of the dial where the menu does not consider a button is selected. Set to zero to disable.\n * **Menu Buttons:** The actual GameObjects that make up the radial menu.\n\n## Class Methods\n\n### TouchAngleDeflection/2\n\n  > `public TouchAngleDeflection(float angle, float deflection)`\n\n * Parameters\n   * `float angle` - The angle of the touch on the radial menu.\n   * `float deflection` - Deflection of the touch, where 0 is the centre and 1 is the edge.\n * Returns\n   * _none_\n\nConstructs an object to hold the angle and deflection of the user's touch on the touchpad\n\n### HoverButton/1\n\n  > `public virtual void HoverButton(TouchAngleDeflection givenTouchAngleDeflection)`\n\n * Parameters\n   * `TouchAngleDeflection givenTouchAngleDeflection` - The angle and deflection on the radial menu.\n * Returns\n   * _none_\n\nThe HoverButton method is used to set the button hover at a given angle and deflection.\n\n### ClickButton/1\n\n  > `public virtual void ClickButton(TouchAngleDeflection givenTouchAngleDeflection)`\n\n * Parameters\n   * `TouchAngleDeflection givenTouchAngleDeflection` - The angle and deflection on the radial menu.\n * Returns\n   * _none_\n\nThe ClickButton method is used to set the button click at a given angle and deflection.\n\n### UnClickButton/1\n\n  > `public virtual void UnClickButton(TouchAngleDeflection givenTouchAngleDeflection)`\n\n * Parameters\n   * `TouchAngleDeflection givenTouchAngleDeflection` - The angle and deflection on the radial menu.\n * Returns\n   * _none_\n\nThe UnClickButton method is used to set the button unclick at a given angle and deflection.\n\n### ToggleMenu/0\n\n  > `public virtual void ToggleMenu()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ToggleMenu method is used to show or hide the radial menu.\n\n### StopTouching/0\n\n  > `public virtual void StopTouching()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe StopTouching method is used to stop touching the menu.\n\n### ShowMenu/0\n\n  > `public virtual void ShowMenu()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ShowMenu method is used to show the menu.\n\n### GetButton/1\n\n  > `public virtual RadialMenuButton GetButton(int id)`\n\n * Parameters\n   * `int id` - The id of the button to retrieve.\n * Returns\n   * `RadialMenuButton` - The found radial menu button.\n\nThe GetButton method is used to get a button from the menu.\n\n### HideMenu/1\n\n  > `public virtual void HideMenu(bool force)`\n\n * Parameters\n   * `bool force` - If true then the menu is always hidden.\n * Returns\n   * _none_\n\nThe HideMenu method is used to hide the menu.\n\n### RegenerateButtons/0\n\n  > `public void RegenerateButtons()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe RegenerateButtons method creates all the button arcs and populates them with desired icons.\n\n### AddButton/1\n\n  > `public void AddButton(RadialMenuButton newButton)`\n\n * Parameters\n   * `RadialMenuButton newButton` - The button to add.\n * Returns\n   * _none_\n\nThe AddButton method is used to add a new button to the menu.\n\n## Example\n\n`VRTK/Examples/030_Controls_RadialTouchpadMenu` displays a radial menu for each controller. The left controller uses the `Hide On Release` variable, so it will only be visible if the left touchpad is being touched. It also uses the `Execute On Unclick` variable to delay execution until the touchpad button is unclicked. The example scene also contains a demonstration of anchoring the RadialMenu to an interactable cube instead of a controller.","excerpt":"","slug":"radialmenu","type":"basic","title":"Radial Menu"}
## Overview Provides a UI element into the world space that can be dropped into a Controller GameObject and used to create and use Radial Menus from the touchpad. **Prefab Usage:** * Place the `VRTK/Prefabs/RadialMenu/RadialMenu` prefab as a child of a Controller script alias GameObject. ## Inspector Parameters * **Buttons:** An array of Buttons that define the interactive buttons required to be displayed as part of the radial menu. * **Button Prefab:** The base for each button in the menu, by default set to a dynamic circle arc that will fill up a portion of the menu. * **Generate On Awake:** If checked, then the buttons will be auto generated on awake. * **Button Thickness:** Percentage of the menu the buttons should fill, 1.0 is a pie slice, 0.1 is a thin ring. * **Button Color:** The background colour of the buttons, default is white. * **Offset Distance:** The distance the buttons should move away from the centre. This creates space between the individual buttons. * **Offset Rotation:** The additional rotation of the Radial Menu. * **Rotate Icons:** Whether button icons should rotate according to their arc or be vertical compared to the controller. * **Icon Margin:** The margin in pixels that the icon should keep within the button. * **Is Shown:** Whether the buttons are shown * **Hide On Release:** Whether the buttons should be visible when not in use. * **Execute On Unclick:** Whether the button action should happen when the button is released, as opposed to happening immediately when the button is pressed. * **Base Haptic Strength:** The base strength of the haptic pulses when the selected button is changed, or a button is pressed. Set to zero to disable. * **Dead Zone:** The dead zone in the middle of the dial where the menu does not consider a button is selected. Set to zero to disable. * **Menu Buttons:** The actual GameObjects that make up the radial menu. ## Class Methods ### TouchAngleDeflection/2 > `public TouchAngleDeflection(float angle, float deflection)` * Parameters * `float angle` - The angle of the touch on the radial menu. * `float deflection` - Deflection of the touch, where 0 is the centre and 1 is the edge. * Returns * _none_ Constructs an object to hold the angle and deflection of the user's touch on the touchpad ### HoverButton/1 > `public virtual void HoverButton(TouchAngleDeflection givenTouchAngleDeflection)` * Parameters * `TouchAngleDeflection givenTouchAngleDeflection` - The angle and deflection on the radial menu. * Returns * _none_ The HoverButton method is used to set the button hover at a given angle and deflection. ### ClickButton/1 > `public virtual void ClickButton(TouchAngleDeflection givenTouchAngleDeflection)` * Parameters * `TouchAngleDeflection givenTouchAngleDeflection` - The angle and deflection on the radial menu. * Returns * _none_ The ClickButton method is used to set the button click at a given angle and deflection. ### UnClickButton/1 > `public virtual void UnClickButton(TouchAngleDeflection givenTouchAngleDeflection)` * Parameters * `TouchAngleDeflection givenTouchAngleDeflection` - The angle and deflection on the radial menu. * Returns * _none_ The UnClickButton method is used to set the button unclick at a given angle and deflection. ### ToggleMenu/0 > `public virtual void ToggleMenu()` * Parameters * _none_ * Returns * _none_ The ToggleMenu method is used to show or hide the radial menu. ### StopTouching/0 > `public virtual void StopTouching()` * Parameters * _none_ * Returns * _none_ The StopTouching method is used to stop touching the menu. ### ShowMenu/0 > `public virtual void ShowMenu()` * Parameters * _none_ * Returns * _none_ The ShowMenu method is used to show the menu. ### GetButton/1 > `public virtual RadialMenuButton GetButton(int id)` * Parameters * `int id` - The id of the button to retrieve. * Returns * `RadialMenuButton` - The found radial menu button. The GetButton method is used to get a button from the menu. ### HideMenu/1 > `public virtual void HideMenu(bool force)` * Parameters * `bool force` - If true then the menu is always hidden. * Returns * _none_ The HideMenu method is used to hide the menu. ### RegenerateButtons/0 > `public void RegenerateButtons()` * Parameters * _none_ * Returns * _none_ The RegenerateButtons method creates all the button arcs and populates them with desired icons. ### AddButton/1 > `public void AddButton(RadialMenuButton newButton)` * Parameters * `RadialMenuButton newButton` - The button to add. * Returns * _none_ The AddButton method is used to add a new button to the menu. ## Example `VRTK/Examples/030_Controls_RadialTouchpadMenu` displays a radial menu for each controller. The left controller uses the `Hide On Release` variable, so it will only be visible if the left touchpad is being touched. It also uses the `Execute On Unclick` variable to delay execution until the touchpad button is unclicked. The example scene also contains a demonstration of anchoring the RadialMenu to an interactable cube instead of a controller.