{"_id":"594949e72be16d0026ec0508","category":{"_id":"594949e62be16d0026ec04db","version":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T17:01:47.129Z","from_sync":false,"order":13,"slug":"utilities","title":"Utilities"},"user":"571fa519db52d01700f5cf3d","parentDoc":null,"project":"571fa55ca0acd42000af9545","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:02:23.122Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"## Overview\n\nThe Device Finder offers a collection of static methods that can be called to find common game devices such as the headset or controllers, or used to determine key information about the connected devices.\n\n## Class Variables\n\n * `public enum Devices` - Possible devices.\n  * `Headset` - The headset.\n  * `LeftController` - The left hand controller.\n  * `RightController` - The right hand controller.\n * `public enum Headsets` - Possible headsets\n  * `Unknown` - An unknown headset.\n  * `OculusRift` - A summary of all Oculus Rift headset versions.\n  * `OculusRiftCV1` - A specific version of the Oculus Rift headset, the Consumer Version 1.\n  * `Vive` - A summary of all HTC Vive headset versions.\n  * `ViveMV` - A specific version of the HTC Vive headset, the first consumer version.\n\n## Class Methods\n\n### GetCurrentControllerType/0\n\n  > `public static SDK_BaseController.ControllerType GetCurrentControllerType()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `SDK_BaseController.ControllerType` - The ControllerType based on the SDK and headset being used.\n\nThe GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used.\n\n### GetControllerIndex/1\n\n  > `public static uint GetControllerIndex(GameObject controller)`\n\n  * Parameters\n   * `GameObject controller` - The controller object to get the index of a controller.\n  * Returns\n   * `uint` - The index of the given controller.\n\nThe GetControllerIndex method is used to find the index of a given controller object.\n\n### GetControllerByIndex/2\n\n  > `public static GameObject GetControllerByIndex(uint index, bool getActual)`\n\n  * Parameters\n   * `uint index` - The index of the actual controller to find.\n   * `bool getActual` - An optional parameter that if true will return the game object that the SDK controller is attached to.\n  * Returns\n   * `GameObject` - The actual controller GameObject that matches the given index.\n\nThe GetControllerByIndex method is used to find a controller based on it's unique index.\n\n### GetControllerOrigin/1\n\n  > `public static Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)`\n\n  * Parameters\n   * `VRTK_ControllerReference controllerReference` - The reference to the controller to get the origin for.\n  * Returns\n   * `Transform` - The transform of the controller origin or if an origin is not set then the transform parent.\n\nThe GetControllerOrigin method is used to find the controller's origin.\n\n### DeviceTransform/1\n\n  > `public static Transform DeviceTransform(Devices device)`\n\n  * Parameters\n   * `Devices device` - The Devices enum to get the transform for.\n  * Returns\n   * `Transform` - The transform for the given Devices enum.\n\nThe DeviceTransform method returns the transform for a given Devices enum.\n\n### GetControllerHandType/1\n\n  > `public static SDK_BaseController.ControllerHand GetControllerHandType(string hand)`\n\n  * Parameters\n   * `string hand` - The string representation of the hand to retrieve the type of. `left` or `right`.\n  * Returns\n   * `SDK_BaseController.ControllerHand` - A ControllerHand representing either the Left or Right hand.\n\nThe GetControllerHandType method is used for getting the enum representation of ControllerHand from a given string.\n\n### GetControllerHand/1\n\n  > `public static SDK_BaseController.ControllerHand GetControllerHand(GameObject controller)`\n\n  * Parameters\n   * `GameObject controller` - The controller game object to check the hand of.\n  * Returns\n   * `SDK_BaseController.ControllerHand` - A ControllerHand representing either the Left or Right hand.\n\nThe GetControllerHand method is used for getting the enum representation of ControllerHand for the given controller game object.\n\n### GetControllerLeftHand/1\n\n  > `public static GameObject GetControllerLeftHand(bool getActual = false)`\n\n  * Parameters\n   * `bool getActual` - An optional parameter that if true will return the game object that the SDK controller is attached to.\n  * Returns\n   * `GameObject` - The left hand controller.\n\nThe GetControllerLeftHand method retrieves the game object for the left hand controller.\n\n### GetControllerRightHand/1\n\n  > `public static GameObject GetControllerRightHand(bool getActual = false)`\n\n  * Parameters\n   * `bool getActual` - An optional parameter that if true will return the game object that the SDK controller is attached to.\n  * Returns\n   * `GameObject` - The right hand controller.\n\nThe GetControllerRightHand method retrieves the game object for the right hand controller.\n\n### IsControllerOfHand/2\n\n  > `public static bool IsControllerOfHand(GameObject checkController, SDK_BaseController.ControllerHand hand)`\n\n  * Parameters\n   * `GameObject checkController` - The actual controller object that is being checked.\n   * `SDK_BaseController.ControllerHand hand` - The representation of a hand to check if the given controller matches.\n  * Returns\n   * `bool` - Is true if the given controller matches the given hand.\n\nThe IsControllerOfHand method is used to check if a given controller game object is of the hand type provided.\n\n### IsControllerLeftHand/1\n\n  > `public static bool IsControllerLeftHand(GameObject checkController)`\n\n  * Parameters\n   * `GameObject checkController` - The controller object that is being checked.\n  * Returns\n   * `bool` - Is true if the given controller is the left controller.\n\nThe IsControllerLeftHand method is used to check if a given controller game object is the left handed controller.\n\n### IsControllerRightHand/1\n\n  > `public static bool IsControllerRightHand(GameObject checkController)`\n\n  * Parameters\n   * `GameObject checkController` - The controller object that is being checked.\n  * Returns\n   * `bool` - Is true if the given controller is the right controller.\n\nThe IsControllerRightHand method is used to check if a given controller game object is the right handed controller.\n\n### GetActualController/1\n\n  > `public static GameObject GetActualController(GameObject givenController)`\n\n  * Parameters\n   * `GameObject givenController` - The GameObject of the controller.\n  * Returns\n   * `GameObject` - The GameObject that is the actual controller.\n\nThe GetActualController method will attempt to get the actual SDK controller object.\n\n### GetScriptAliasController/1\n\n  > `public static GameObject GetScriptAliasController(GameObject givenController)`\n\n  * Parameters\n   * `GameObject givenController` - The GameObject of the controller.\n  * Returns\n   * `GameObject` - The GameObject that is the alias controller containing the scripts.\n\nThe GetScriptAliasController method will attempt to get the object that contains the scripts for the controller.\n\n### GetModelAliasController/1\n\n  > `public static GameObject GetModelAliasController(GameObject givenController)`\n\n  * Parameters\n   * `GameObject givenController` - The GameObject of the controller.\n  * Returns\n   * `GameObject` - The GameObject that is the alias controller containing the controller model.\n\nThe GetModelAliasController method will attempt to get the object that contains the model for the controller.\n\n### GetModelAliasControllerHand/1\n\n  > `public static SDK_BaseController.ControllerHand GetModelAliasControllerHand(GameObject givenObject)`\n\n  * Parameters\n   * `GameObject givenObject` - The GameObject that may represent a model alias.\n  * Returns\n   * `SDK_BaseController.ControllerHand` - The enum of the ControllerHand that the given GameObject may represent.\n\nThe GetModelAliasControllerHand method will return the hand that the given model alias GameObject is for.\n\n### GetControllerVelocity/1\n\n  > `public static Vector3 GetControllerVelocity(VRTK_ControllerReference controllerReference)`\n\n  * Parameters\n   * `VRTK_ControllerReference controllerReference` - The reference to the controller.\n  * Returns\n   * `Vector3` - A 3 dimensional vector containing the current real world physical controller velocity.\n\nThe GetControllerVelocity method is used for getting the current velocity of the physical game controller. This can be useful to determine the speed at which the controller is being swung or the direction it is being moved in.\n\n### GetControllerAngularVelocity/1\n\n  > `public static Vector3 GetControllerAngularVelocity(VRTK_ControllerReference controllerReference)`\n\n  * Parameters\n   * `VRTK_ControllerReference controllerReference` - The reference to the controller.\n  * Returns\n   * `Vector3` - A 3 dimensional vector containing the current real world physical controller angular (rotational) velocity.\n\nThe GetControllerAngularVelocity method is used for getting the current rotational velocity of the physical game controller. This can be useful for determining which way the controller is being rotated and at what speed the rotation is occurring.\n\n### GetHeadsetVelocity/0\n\n  > `public static Vector3 GetHeadsetVelocity()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `Vector3` - A Vector3 containing the current velocity of the headset.\n\nThe GetHeadsetVelocity method is used to determine the current velocity of the headset.\n\n### GetHeadsetAngularVelocity/0\n\n  > `public static Vector3 GetHeadsetAngularVelocity()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `Vector3` - A Vector3 containing the current angular velocity of the headset.\n\nThe GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset.\n\n### HeadsetTransform/0\n\n  > `public static Transform HeadsetTransform()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `Transform` - The transform of the VR Headset component.\n\nThe HeadsetTransform method is used to retrieve the transform for the VR Headset in the scene. It can be useful to determine the position of the user's head in the game world.\n\n### HeadsetCamera/0\n\n  > `public static Transform HeadsetCamera()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `Transform` - The transform of the VR Camera component.\n\nThe HeadsetCamera method is used to retrieve the transform for the VR Camera in the scene.\n\n### ResetHeadsetTypeCache/0\n\n  > `public static void ResetHeadsetTypeCache()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * _none_\n\nThe ResetHeadsetTypeCache resets the cache holding the current headset type value.\n\n### GetHeadsetType/1\n\n  > `public static Headsets GetHeadsetType(bool summary = false)`\n\n  * Parameters\n   * `bool summary` - If this is true, then the generic name for the headset is returned not including the version type (e.g. OculusRift will be returned for DK2 and CV1).\n  * Returns\n   * `Headsets` - The Headset type that is connected.\n\nThe GetHeadsetType method returns the type of headset connected to the computer.\n\n### PlayAreaTransform/0\n\n  > `public static Transform PlayAreaTransform()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * `Transform` - The transform of the VR Play Area component.\n\nThe PlayAreaTransform method is used to retrieve the transform for the play area in the scene.","excerpt":"","slug":"vrtk_devicefinder","type":"basic","title":"VRTK_DeviceFinder"}
## Overview The Device Finder offers a collection of static methods that can be called to find common game devices such as the headset or controllers, or used to determine key information about the connected devices. ## Class Variables * `public enum Devices` - Possible devices. * `Headset` - The headset. * `LeftController` - The left hand controller. * `RightController` - The right hand controller. * `public enum Headsets` - Possible headsets * `Unknown` - An unknown headset. * `OculusRift` - A summary of all Oculus Rift headset versions. * `OculusRiftCV1` - A specific version of the Oculus Rift headset, the Consumer Version 1. * `Vive` - A summary of all HTC Vive headset versions. * `ViveMV` - A specific version of the HTC Vive headset, the first consumer version. ## Class Methods ### GetCurrentControllerType/0 > `public static SDK_BaseController.ControllerType GetCurrentControllerType()` * Parameters * _none_ * Returns * `SDK_BaseController.ControllerType` - The ControllerType based on the SDK and headset being used. The GetCurrentControllerType method returns the current used ControllerType based on the SDK and headset being used. ### GetControllerIndex/1 > `public static uint GetControllerIndex(GameObject controller)` * Parameters * `GameObject controller` - The controller object to get the index of a controller. * Returns * `uint` - The index of the given controller. The GetControllerIndex method is used to find the index of a given controller object. ### GetControllerByIndex/2 > `public static GameObject GetControllerByIndex(uint index, bool getActual)` * Parameters * `uint index` - The index of the actual controller to find. * `bool getActual` - An optional parameter that if true will return the game object that the SDK controller is attached to. * Returns * `GameObject` - The actual controller GameObject that matches the given index. The GetControllerByIndex method is used to find a controller based on it's unique index. ### GetControllerOrigin/1 > `public static Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)` * Parameters * `VRTK_ControllerReference controllerReference` - The reference to the controller to get the origin for. * Returns * `Transform` - The transform of the controller origin or if an origin is not set then the transform parent. The GetControllerOrigin method is used to find the controller's origin. ### DeviceTransform/1 > `public static Transform DeviceTransform(Devices device)` * Parameters * `Devices device` - The Devices enum to get the transform for. * Returns * `Transform` - The transform for the given Devices enum. The DeviceTransform method returns the transform for a given Devices enum. ### GetControllerHandType/1 > `public static SDK_BaseController.ControllerHand GetControllerHandType(string hand)` * Parameters * `string hand` - The string representation of the hand to retrieve the type of. `left` or `right`. * Returns * `SDK_BaseController.ControllerHand` - A ControllerHand representing either the Left or Right hand. The GetControllerHandType method is used for getting the enum representation of ControllerHand from a given string. ### GetControllerHand/1 > `public static SDK_BaseController.ControllerHand GetControllerHand(GameObject controller)` * Parameters * `GameObject controller` - The controller game object to check the hand of. * Returns * `SDK_BaseController.ControllerHand` - A ControllerHand representing either the Left or Right hand. The GetControllerHand method is used for getting the enum representation of ControllerHand for the given controller game object. ### GetControllerLeftHand/1 > `public static GameObject GetControllerLeftHand(bool getActual = false)` * Parameters * `bool getActual` - An optional parameter that if true will return the game object that the SDK controller is attached to. * Returns * `GameObject` - The left hand controller. The GetControllerLeftHand method retrieves the game object for the left hand controller. ### GetControllerRightHand/1 > `public static GameObject GetControllerRightHand(bool getActual = false)` * Parameters * `bool getActual` - An optional parameter that if true will return the game object that the SDK controller is attached to. * Returns * `GameObject` - The right hand controller. The GetControllerRightHand method retrieves the game object for the right hand controller. ### IsControllerOfHand/2 > `public static bool IsControllerOfHand(GameObject checkController, SDK_BaseController.ControllerHand hand)` * Parameters * `GameObject checkController` - The actual controller object that is being checked. * `SDK_BaseController.ControllerHand hand` - The representation of a hand to check if the given controller matches. * Returns * `bool` - Is true if the given controller matches the given hand. The IsControllerOfHand method is used to check if a given controller game object is of the hand type provided. ### IsControllerLeftHand/1 > `public static bool IsControllerLeftHand(GameObject checkController)` * Parameters * `GameObject checkController` - The controller object that is being checked. * Returns * `bool` - Is true if the given controller is the left controller. The IsControllerLeftHand method is used to check if a given controller game object is the left handed controller. ### IsControllerRightHand/1 > `public static bool IsControllerRightHand(GameObject checkController)` * Parameters * `GameObject checkController` - The controller object that is being checked. * Returns * `bool` - Is true if the given controller is the right controller. The IsControllerRightHand method is used to check if a given controller game object is the right handed controller. ### GetActualController/1 > `public static GameObject GetActualController(GameObject givenController)` * Parameters * `GameObject givenController` - The GameObject of the controller. * Returns * `GameObject` - The GameObject that is the actual controller. The GetActualController method will attempt to get the actual SDK controller object. ### GetScriptAliasController/1 > `public static GameObject GetScriptAliasController(GameObject givenController)` * Parameters * `GameObject givenController` - The GameObject of the controller. * Returns * `GameObject` - The GameObject that is the alias controller containing the scripts. The GetScriptAliasController method will attempt to get the object that contains the scripts for the controller. ### GetModelAliasController/1 > `public static GameObject GetModelAliasController(GameObject givenController)` * Parameters * `GameObject givenController` - The GameObject of the controller. * Returns * `GameObject` - The GameObject that is the alias controller containing the controller model. The GetModelAliasController method will attempt to get the object that contains the model for the controller. ### GetModelAliasControllerHand/1 > `public static SDK_BaseController.ControllerHand GetModelAliasControllerHand(GameObject givenObject)` * Parameters * `GameObject givenObject` - The GameObject that may represent a model alias. * Returns * `SDK_BaseController.ControllerHand` - The enum of the ControllerHand that the given GameObject may represent. The GetModelAliasControllerHand method will return the hand that the given model alias GameObject is for. ### GetControllerVelocity/1 > `public static Vector3 GetControllerVelocity(VRTK_ControllerReference controllerReference)` * Parameters * `VRTK_ControllerReference controllerReference` - The reference to the controller. * Returns * `Vector3` - A 3 dimensional vector containing the current real world physical controller velocity. The GetControllerVelocity method is used for getting the current velocity of the physical game controller. This can be useful to determine the speed at which the controller is being swung or the direction it is being moved in. ### GetControllerAngularVelocity/1 > `public static Vector3 GetControllerAngularVelocity(VRTK_ControllerReference controllerReference)` * Parameters * `VRTK_ControllerReference controllerReference` - The reference to the controller. * Returns * `Vector3` - A 3 dimensional vector containing the current real world physical controller angular (rotational) velocity. The GetControllerAngularVelocity method is used for getting the current rotational velocity of the physical game controller. This can be useful for determining which way the controller is being rotated and at what speed the rotation is occurring. ### GetHeadsetVelocity/0 > `public static Vector3 GetHeadsetVelocity()` * Parameters * _none_ * Returns * `Vector3` - A Vector3 containing the current velocity of the headset. The GetHeadsetVelocity method is used to determine the current velocity of the headset. ### GetHeadsetAngularVelocity/0 > `public static Vector3 GetHeadsetAngularVelocity()` * Parameters * _none_ * Returns * `Vector3` - A Vector3 containing the current angular velocity of the headset. The GetHeadsetAngularVelocity method is used to determine the current angular velocity of the headset. ### HeadsetTransform/0 > `public static Transform HeadsetTransform()` * Parameters * _none_ * Returns * `Transform` - The transform of the VR Headset component. The HeadsetTransform method is used to retrieve the transform for the VR Headset in the scene. It can be useful to determine the position of the user's head in the game world. ### HeadsetCamera/0 > `public static Transform HeadsetCamera()` * Parameters * _none_ * Returns * `Transform` - The transform of the VR Camera component. The HeadsetCamera method is used to retrieve the transform for the VR Camera in the scene. ### ResetHeadsetTypeCache/0 > `public static void ResetHeadsetTypeCache()` * Parameters * _none_ * Returns * _none_ The ResetHeadsetTypeCache resets the cache holding the current headset type value. ### GetHeadsetType/1 > `public static Headsets GetHeadsetType(bool summary = false)` * Parameters * `bool summary` - If this is true, then the generic name for the headset is returned not including the version type (e.g. OculusRift will be returned for DK2 and CV1). * Returns * `Headsets` - The Headset type that is connected. The GetHeadsetType method returns the type of headset connected to the computer. ### PlayAreaTransform/0 > `public static Transform PlayAreaTransform()` * Parameters * _none_ * Returns * `Transform` - The transform of the VR Play Area component. The PlayAreaTransform method is used to retrieve the transform for the play area in the scene.