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 headsetsUnknown
- 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.ViveDVT
- A specific version of the HTC Vive headset, the first consumer version.OculusRiftES07
- A specific version of the Oculus Rift headset, the rare ES07.
Class Methods
GetCurrentControllerType/1
public static SDK_BaseController.ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.
- 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
orright
.
- 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.
GetControllerReferenceLeftHand/0
public static VRTK_ControllerReference GetControllerReferenceLeftHand()
- Parameters
- none
- Returns
VRTK_ControllerReference
- The Controller Reference for the left hand controller.
The GetControllerReferenceLeftHand returns a Controller Reference for the left hand controller.
GetControllerReferenceRightHand/0
public static VRTK_ControllerReference GetControllerReferenceRightHand()
- Parameters
- none
- Returns
VRTK_ControllerReference
- The Controller Reference for the right hand controller.
The GetControllerReferenceRightHand returns a Controller Reference for the right hand controller.
GetControllerReferenceForHand/1
public static VRTK_ControllerReference GetControllerReferenceForHand(SDK_BaseController.ControllerHand hand)
- Parameters
- none
- Returns
VRTK_ControllerReference
- The Controller Reference for the given hand controller.
The GetControllerReferenceForHand returns a Controller Reference for the given 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.
GetOppositeHand/1
public static SDK_BaseController.ControllerHand GetOppositeHand(SDK_BaseController.ControllerHand currentHand)
- Parameters
SDK_BaseController.ControllerHand currentHand
- The current hand.
- Returns
SDK_BaseController.ControllerHand
- The opposite hand.
The GetOppositeHand method returns the other hand type from the current hand given.
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.
GetHeadsetTypeAsString/0
public static string GetHeadsetTypeAsString()
- Parameters
- none
- Returns
string
- The string of the headset connected.
The GetHeadsetTypeAsString method returns a string representing the type of headset connected.
GetHeadsetType/0
public static SDK_BaseHeadset.HeadsetType GetHeadsetType()
- Parameters
- none
- Returns
SDK_BaseHeadset.HeadsetType
- The Headset type that is connected.
The GetHeadsetType method returns the type of headset currently connected.
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.
Updated less than a minute ago