{"_id":"594949e62be16d0026ec04f7","category":{"_id":"594949e62be16d0026ec04da","version":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T17:04:07.774Z","from_sync":false,"order":12,"slug":"3d-controls","title":"3D Controls"},"parentDoc":null,"project":"571fa55ca0acd42000af9545","user":"571fa519db52d01700f5cf3d","version":{"_id":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":2,"createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["594949e62be16d0026ec04ce","594949e62be16d0026ec04cf","594949e62be16d0026ec04d0","594949e62be16d0026ec04d1","594949e62be16d0026ec04d2","594949e62be16d0026ec04d3","594949e62be16d0026ec04d4","594949e62be16d0026ec04d5","594949e62be16d0026ec04d6","594949e62be16d0026ec04d7","594949e62be16d0026ec04d8","594949e62be16d0026ec04d9","594949e62be16d0026ec04da","594949e62be16d0026ec04db","594949e62be16d0026ec04dc","594949e62be16d0026ec04dd","594949e62be16d0026ec04de","594949e62be16d0026ec04df","594949e62be16d0026ec04e0","594949e62be16d0026ec04e1","59497219f4a8980024dd0631"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Kunekune","version_clean":"3.2.0","version":"3.2.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T17:04:49.952Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"> extends [VRTK_Control](doc:vrtk_control)\n\n## Overview\n\nAttaching the script to a game object will allow the user to interact with it as if it were a push button. The direction into which the button should be pushable can be freely set and auto-detection is supported. Since this is physics-based there needs to be empty space in the push direction so that the button can move.\n\nThe script will instantiate the required Rigidbody and ConstantForce components automatically in case they do not exist yet.\n\n## Inspector Parameters\n\n * **Connected To:** An optional game object to which the button will be connected. If the game object moves the button will follow along.\n * **Direction:** The axis on which the button should move. All other axis will be frozen.\n * **Activation Distance:** The local distance the button needs to be pushed until a push event is triggered.\n * **Button Strength:** The amount of force needed to push the button down as well as the speed with which it will go back into its original position.\n\n## Class Variables\n\n * `public enum ButtonDirection` - 3D Control Button Directions\n  * `autodetect` - Attempt to auto detect the axis\n  * `x` - X axis\n  * `y` - Y axis\n  * `z` - Z axis\n  * `negX` - Negative X axis\n  * `negY` - Negative Y axis\n  * `negZ` - Negative Z axis\n\n## Class Events\n\n * `Pushed` - Emitted when the 3D Button has reached its activation distance.\n * `Released` - Emitted when the 3D Button's position has become less than activation distance after being pressed.\n\n## Unity Events\n\nAdding the `VRTK_Button_UnityEvents` component to `VRTK_Button` object allows access to `UnityEvents` that will react identically to the Class Events.\n\n * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`.\n\n## Event Payload\n\n * `float value` - The current value being reported by the control.\n * `float normalizedValue` - The normalized value being reported by the control.\n\n## Example\n\n`VRTK/Examples/025_Controls_Overview` shows a collection of pressable buttons that are interacted with by activating the rigidbody on the controller by pressing the grab button without grabbing an object.","excerpt":"","slug":"vrtk_button","type":"basic","title":"VRTK_Button"}
> extends [VRTK_Control](doc:vrtk_control) ## Overview Attaching the script to a game object will allow the user to interact with it as if it were a push button. The direction into which the button should be pushable can be freely set and auto-detection is supported. Since this is physics-based there needs to be empty space in the push direction so that the button can move. The script will instantiate the required Rigidbody and ConstantForce components automatically in case they do not exist yet. ## Inspector Parameters * **Connected To:** An optional game object to which the button will be connected. If the game object moves the button will follow along. * **Direction:** The axis on which the button should move. All other axis will be frozen. * **Activation Distance:** The local distance the button needs to be pushed until a push event is triggered. * **Button Strength:** The amount of force needed to push the button down as well as the speed with which it will go back into its original position. ## Class Variables * `public enum ButtonDirection` - 3D Control Button Directions * `autodetect` - Attempt to auto detect the axis * `x` - X axis * `y` - Y axis * `z` - Z axis * `negX` - Negative X axis * `negY` - Negative Y axis * `negZ` - Negative Z axis ## Class Events * `Pushed` - Emitted when the 3D Button has reached its activation distance. * `Released` - Emitted when the 3D Button's position has become less than activation distance after being pressed. ## Unity Events Adding the `VRTK_Button_UnityEvents` component to `VRTK_Button` object allows access to `UnityEvents` that will react identically to the Class Events. * All C# delegate events are mapped to a Unity Event with the `On` prefix. e.g. `MyEvent` -> `OnMyEvent`. ## Event Payload * `float value` - The current value being reported by the control. * `float normalizedValue` - The normalized value being reported by the control. ## Example `VRTK/Examples/025_Controls_Overview` shows a collection of pressable buttons that are interacted with by activating the rigidbody on the controller by pressing the grab button without grabbing an object.