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.Left_Controller
- The left hand controller.Right_Controller
- The right hand controller.public enum ControllerHand
- Controller hand reference.None
- No hand is assigned.Left
- The left hand is assigned.Right
- The right hand is assigned.
Class Methods
TrackedIndexIsController/1
public static bool TrackedIndexIsController(uint index)
- Parameters
uint index
- The index of the tracked object to find.- Returns
bool
- Returns true if the given index is a tracked object of type controller.
The TrackedIndexIsController method is used to determine if a given tracked object index belongs to a tracked controller.
GetControllerIndex/1
public static uint GetControllerIndex(GameObject controller)
- Parameters
GameObject controller
- The controller object to check the index on.- Returns
uint
- The index of the given controller.
The GetControllerIndex method is used to find the index of a given controller object.
TrackedObjectByIndex/1
public static GameObject TrackedObjectByIndex(uint index)
- Parameters
uint index
- The index of the tracked object to find.- Returns
GameObject
- The tracked object that matches the given index.
The TrackedObjectByIndex method is used to find the GameObject of a tracked object by its generated index.
TrackedObjectOrigin/1
public static Transform TrackedObjectOrigin(GameObject obj)
- Parameters
GameObject obj
- The GameObject to get the origin for.- Returns
Transform
- The transform of the tracked object's origin or if an origin is not set then the transform parent.
The TrackedObjectOrigin method is used to find the tracked object's origin.
TrackedObjectOfGameObject/2
public static GameObject TrackedObjectOfGameObject(GameObject obj, out uint index)
- Parameters
GameObject obj
- The game object to check for the presence of a tracked object on.out uint index
- The variable to store the tracked object's index if one is found. It returns 0 if no index is found.- Returns
GameObject
- The GameObject of the tracked object.
The TrackedObjectOfGameObject method is used to find the tracked object associated with the given game object and it can also return the index of the tracked object.
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 ControllerHand GetControllerHandType(string hand)
- Parameters
string hand
- The string representation of the hand to retrieve the type of.left
orright
.- Returns
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 ControllerHand GetControllerHand(GameObject controller)
- Parameters
GameObject controller
- The controller game object to check the hand of.- Returns
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/0
public static GameObject GetControllerLeftHand()
- Parameters
- none
- Returns
GameObject
- The left hand controller.
The GetControllerLeftHand method retrieves the game object for the left hand controller.
GetControllerRightHand/0
public static GameObject GetControllerRightHand()
- Parameters
- none
- 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, ControllerHand hand)
- Parameters
GameObject checkController
- The actual controller object that is being checked.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.
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.
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