Guides
These docs are for v3.0.0. Click to read the latest docs for v3.3.0.

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.

Class Methods

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(GameObject controller)

  • Parameters
  • GameObject controller - The GameObject 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.

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.