{"_id":"5b1f90d19c68300003297aee","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"},"category":{"_id":"5b1f900bd4c5f000036b57bd","project":"571fa55ca0acd42000af9545","version":"5b1f8576c2505d00031254db","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-06-12T09:19:07.462Z","from_sync":false,"order":6,"slug":"interactors","title":"Interactors"},"user":"571fa519db52d01700f5cf3d","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-06-12T09:22:25.561Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"## Overview\n\nDetermines if the Interact Touch can initiate a use interaction with the touched Interactable Object.\n\n**Required Components:**\n * `VRTK_InteractTouch` - The touch component to determine when a valid touch has taken place to denote a use interaction can occur. This must be applied on the same GameObject as this script if one is not provided via the `Interact Touch` parameter.\n\n**Optional Components:**\n * `VRTK_ControllerEvents` - The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the `Controller Events` parameter.\n * `VRTK_InteractGrab` - The grab component to determine when a valid grab has taken place. This must be applied on the same GameObject as this script if one is not provided via the `Interact Grab` parameter.\n\n**Script Usage:**\n * Place the `VRTK_InteractUse` script on either:\n   * The GameObject with the Interact Touch and Controller Events scripts.\n   * Any other scene GameObject and provide a valid `VRTK_ControllerEvents` component to the `Controller Events` parameter and a valid `VRTK_InteractTouch` component to the `Interact Touch` parameter of this script.\n\n## Inspector Parameters\n\n * **Use Button:** The button used to use/unuse a touched Interactable Object.\n * **Controller Events:** The Controller Events to listen for the events on. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime.\n * **Interact Touch:** The Interact Touch to listen for touches on. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime.\n * **Interact Grab:** The Interact Grab to listen for grab actions on. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime.\n\n## Class Events\n\n * `UseButtonPressed` - Emitted when the use toggle alias button is pressed.\n * `UseButtonReleased` - Emitted when the use toggle alias button is released.\n * `ControllerStartUseInteractableObject` - Emitted when a use of a valid object is started.\n * `ControllerUseInteractableObject` - Emitted when a valid object starts being used.\n * `ControllerStartUnuseInteractableObject` - Emitted when a unuse of a valid object is started.\n * `ControllerUnuseInteractableObject` - Emitted when a valid object stops being used.\n\n## Unity Events\n\nAdding the `VRTK_InteractUse_UnityEvents` component to `VRTK_InteractUse` 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## Class Methods\n\n### IsUseButtonPressed/0\n\n  > `public virtual bool IsUseButtonPressed()`\n\n * Parameters\n   * _none_\n * Returns\n   * `bool` - Returns `true` if the use alias button is being held down.\n\nThe IsUsebuttonPressed method determines whether the current use alias button is being pressed down.\n\n### GetUsingObject/0\n\n  > `public virtual GameObject GetUsingObject()`\n\n * Parameters\n   * _none_\n * Returns\n   * `GameObject` - The GameObject of what is currently being used by this Interact Use.\n\nThe GetUsingObject method returns the current GameObject being used by the Interact Use.\n\n### ForceStopUsing/0\n\n  > `public virtual void ForceStopUsing()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ForceStopUsing method will force the Interact Use to stop using the currently touched Interactable Object and will also stop the Interactable Object's using action.\n\n### ForceResetUsing/0\n\n  > `public virtual void ForceResetUsing()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe ForceResetUsing will force the Interact Use to stop using the currently touched Interactable Object but the Interactable Object will continue with it's existing using action.\n\n### AttemptUse/0\n\n  > `public virtual void AttemptUse()`\n\n * Parameters\n   * _none_\n * Returns\n   * _none_\n\nThe AttemptUse method will attempt to use the currently touched Interactable Object without needing to press the use button on the controller.\n\n## Example\n\n`VRTK/Examples/006_Controller_UsingADoor` simulates using a door object to open and close it. It also has a cube on the floor that can be grabbed to show how interactable objects can be usable or grabbable.\n\n`VRTK/Examples/008_Controller_UsingAGrabbedObject` shows that objects can be grabbed with one button and used with another (e.g. firing a gun).","excerpt":"","slug":"vrtk_interactuse-1","type":"basic","title":"VRTK_InteractUse"}
## Overview Determines if the Interact Touch can initiate a use interaction with the touched Interactable Object. **Required Components:** * `VRTK_InteractTouch` - The touch component to determine when a valid touch has taken place to denote a use interaction can occur. This must be applied on the same GameObject as this script if one is not provided via the `Interact Touch` parameter. **Optional Components:** * `VRTK_ControllerEvents` - The events component to listen for the button presses on. This must be applied on the same GameObject as this script if one is not provided via the `Controller Events` parameter. * `VRTK_InteractGrab` - The grab component to determine when a valid grab has taken place. This must be applied on the same GameObject as this script if one is not provided via the `Interact Grab` parameter. **Script Usage:** * Place the `VRTK_InteractUse` script on either: * The GameObject with the Interact Touch and Controller Events scripts. * Any other scene GameObject and provide a valid `VRTK_ControllerEvents` component to the `Controller Events` parameter and a valid `VRTK_InteractTouch` component to the `Interact Touch` parameter of this script. ## Inspector Parameters * **Use Button:** The button used to use/unuse a touched Interactable Object. * **Controller Events:** The Controller Events to listen for the events on. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime. * **Interact Touch:** The Interact Touch to listen for touches on. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime. * **Interact Grab:** The Interact Grab to listen for grab actions on. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime. ## Class Events * `UseButtonPressed` - Emitted when the use toggle alias button is pressed. * `UseButtonReleased` - Emitted when the use toggle alias button is released. * `ControllerStartUseInteractableObject` - Emitted when a use of a valid object is started. * `ControllerUseInteractableObject` - Emitted when a valid object starts being used. * `ControllerStartUnuseInteractableObject` - Emitted when a unuse of a valid object is started. * `ControllerUnuseInteractableObject` - Emitted when a valid object stops being used. ## Unity Events Adding the `VRTK_InteractUse_UnityEvents` component to `VRTK_InteractUse` 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`. ## Class Methods ### IsUseButtonPressed/0 > `public virtual bool IsUseButtonPressed()` * Parameters * _none_ * Returns * `bool` - Returns `true` if the use alias button is being held down. The IsUsebuttonPressed method determines whether the current use alias button is being pressed down. ### GetUsingObject/0 > `public virtual GameObject GetUsingObject()` * Parameters * _none_ * Returns * `GameObject` - The GameObject of what is currently being used by this Interact Use. The GetUsingObject method returns the current GameObject being used by the Interact Use. ### ForceStopUsing/0 > `public virtual void ForceStopUsing()` * Parameters * _none_ * Returns * _none_ The ForceStopUsing method will force the Interact Use to stop using the currently touched Interactable Object and will also stop the Interactable Object's using action. ### ForceResetUsing/0 > `public virtual void ForceResetUsing()` * Parameters * _none_ * Returns * _none_ The ForceResetUsing will force the Interact Use to stop using the currently touched Interactable Object but the Interactable Object will continue with it's existing using action. ### AttemptUse/0 > `public virtual void AttemptUse()` * Parameters * _none_ * Returns * _none_ The AttemptUse method will attempt to use the currently touched Interactable Object without needing to press the use button on the controller. ## Example `VRTK/Examples/006_Controller_UsingADoor` simulates using a door object to open and close it. It also has a cube on the floor that can be grabbed to show how interactable objects can be usable or grabbable. `VRTK/Examples/008_Controller_UsingAGrabbedObject` shows that objects can be grabbed with one button and used with another (e.g. firing a gun).