SDK_UnityController
extends SDK_BaseController
Overview
The Unity Controller SDK script provides a bridge to the base Unity input device support.
Class Methods
ProcessUpdate/2
public override void ProcessUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
- Parameters
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the update.
- Returns
- none
The ProcessUpdate method enables an SDK to run logic for every Unity Update
ProcessFixedUpdate/2
public override void ProcessFixedUpdate(VRTK_ControllerReference controllerReference, Dictionary<string, object> options)
- Parameters
VRTK_ControllerReference controllerReference
- The reference for the controller.Dictionary<string, object> options
- A dictionary of generic options that can be used to within the fixed update.
- Returns
- none
The ProcessFixedUpdate method enables an SDK to run logic for every Unity FixedUpdate
GetCurrentControllerType/1
public override ControllerType GetCurrentControllerType(VRTK_ControllerReference controllerReference = null)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the controller to get type of.
- Returns
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.
GetControllerDefaultColliderPath/1
public override string GetControllerDefaultColliderPath(ControllerHand hand)
- Parameters
ControllerHand hand
- The controller hand to check for
- Returns
string
- A path to the resource that contains the collider GameObject.
The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK.
GetControllerElementPath/3
public override string GetControllerElementPath(ControllerElements element, ControllerHand hand, bool fullPath = false)
- Parameters
ControllerElements element
- The controller element to look up.ControllerHand hand
- The controller hand to look up.bool fullPath
- Whether to get the initial path or the full path to the element.
- Returns
string
- A string containing the path to the game object that the controller element resides in.
The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in.
GetControllerIndex/1
public override uint GetControllerIndex(GameObject controller)
- Parameters
GameObject controller
- The GameObject containing the controller.
- Returns
uint
- The index of the given controller.
The GetControllerIndex method returns the index of the given controller.
GetControllerByIndex/2
public override GameObject GetControllerByIndex(uint index, bool actual = false)
- Parameters
uint index
- The index of the controller to find.bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.
- Returns
GameObject
- The GameObject of the controller
The GetControllerByIndex method returns the GameObject of a controller with a specific index.
GetControllerOrigin/1
public override Transform GetControllerOrigin(VRTK_ControllerReference controllerReference)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the controller to retrieve the origin from.
- Returns
Transform
- A Transform containing the origin of the controller.
The GetControllerOrigin method returns the origin of the given controller.
GetControllerLeftHand/1
public override GameObject GetControllerLeftHand(bool actual = false)
- Parameters
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.
- Returns
GameObject
- The GameObject containing the left hand controller.
The GetControllerLeftHand method returns the GameObject containing the representation of the left hand controller.
GetControllerRightHand/1
public override GameObject GetControllerRightHand(bool actual = false)
- Parameters
bool actual
- If true it will return the actual controller, if false it will return the script alias controller GameObject.
- Returns
GameObject
- The GameObject containing the right hand controller.
The GetControllerRightHand method returns the GameObject containing the representation of the right hand controller.
IsControllerLeftHand/1
public override bool IsControllerLeftHand(GameObject controller)
- Parameters
GameObject controller
- The GameObject to check.
- Returns
bool
- Returns true if the given controller is the left hand controller.
The IsControllerLeftHand/1 method is used to check if the given controller is the the left hand controller.
IsControllerRightHand/1
public override bool IsControllerRightHand(GameObject controller)
- Parameters
GameObject controller
- The GameObject to check.
- Returns
bool
- Returns true if the given controller is the right hand controller.
The IsControllerRightHand/1 method is used to check if the given controller is the the right hand controller.
IsControllerLeftHand/2
public override bool IsControllerLeftHand(GameObject controller, bool actual)
- Parameters
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.
- Returns
bool
- Returns true if the given controller is the left hand controller.
The IsControllerLeftHand/2 method is used to check if the given controller is the the left hand controller.
IsControllerRightHand/2
public override bool IsControllerRightHand(GameObject controller, bool actual)
- Parameters
GameObject controller
- The GameObject to check.bool actual
- If true it will check the actual controller, if false it will check the script alias controller.
- Returns
bool
- Returns true if the given controller is the right hand controller.
The IsControllerRightHand/2 method is used to check if the given controller is the the right hand controller.
WaitForControllerModel/1
public override bool WaitForControllerModel(ControllerHand hand)
- Parameters
ControllerHand hand
- The hand to determine if the controller model will be ready for.
- Returns
bool
- Returns true if the controller model requires loading in at runtime and therefore needs waiting for. Returns false if the controller model will be available at start.
The WaitForControllerModel method determines whether the controller model for the given hand requires waiting to load in on scene start.
GetControllerModel/1
public override GameObject GetControllerModel(GameObject controller)
- Parameters
GameObject controller
- The GameObject to get the model alias for.
- Returns
GameObject
- The GameObject that has the model alias within it.
The GetControllerModel method returns the model alias for the given GameObject.
GetControllerModel/1
public override GameObject GetControllerModel(ControllerHand hand)
- Parameters
ControllerHand hand
- The hand enum of which controller model to retrieve.
- Returns
GameObject
- The GameObject that has the model alias within it.
The GetControllerModel method returns the model alias for the given controller hand.
GetControllerRenderModel/1
public override GameObject GetControllerRenderModel(VRTK_ControllerReference controllerReference)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the controller to check.
- Returns
GameObject
- A GameObject containing the object that has a render model for the controller.
The GetControllerRenderModel method gets the game object that contains the given controller's render model.
SetControllerRenderModelWheel/2
public override void SetControllerRenderModelWheel(GameObject renderModel, bool state)
- Parameters
GameObject renderModel
- The GameObject containing the controller render model.bool state
- If true and the render model has a scroll wheen then it will be displayed, if false then the scroll wheel will be hidden.
- Returns
- none
The SetControllerRenderModelWheel method sets the state of the scroll wheel on the controller render model.
HapticPulse/2
public override void HapticPulse(VRTK_ControllerReference controllerReference, float strength = 0.5f)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.float strength
- The intensity of the rumble of the controller motor.0
to1
.
- Returns
- none
The HapticPulse/2 method is used to initiate a simple haptic pulse on the tracked object of the given controller reference.
HapticPulse/2
public override bool HapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the tracked object to initiate the haptic pulse on.AudioClip clip
- The audio clip to use for the haptic pattern.
- Returns
- none
The HapticPulse/2 method is used to initiate a haptic pulse based on an audio clip on the tracked object of the given controller reference.
GetHapticModifiers/0
public override SDK_ControllerHapticModifiers GetHapticModifiers()
- Parameters
- none
- Returns
SDK_ControllerHapticModifiers
- An SDK_ControllerHapticModifiers object with a givendurationModifier
and anintervalModifier
.
The GetHapticModifiers method is used to return modifiers for the duration and interval if the SDK handles it slightly differently.
GetVelocity/1
public override Vector3 GetVelocity(VRTK_ControllerReference controllerReference)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.
- Returns
Vector3
- A Vector3 containing the current velocity of the tracked object.
The GetVelocity method is used to determine the current velocity of the tracked object on the given controller reference.
GetAngularVelocity/1
public override Vector3 GetAngularVelocity(VRTK_ControllerReference controllerReference)
- Parameters
VRTK_ControllerReference controllerReference
- The reference to the tracked object to check for.
- Returns
Vector3
- A Vector3 containing the current angular velocity of the tracked object.
The GetAngularVelocity method is used to determine the current angular velocity of the tracked object on the given controller reference.
IsTouchpadStatic/4
public override bool IsTouchpadStatic(bool isTouched, Vector2 currentAxisValues, Vector2 previousAxisValues, int compareFidelity)
- Parameters
Vector2 currentAxisValues
-Vector2 previousAxisValues
-int compareFidelity
-
- Returns
bool
- Returns true if the touchpad is not currently being touched or moved.
The IsTouchpadStatic method is used to determine if the touchpad is currently not being moved.
GetButtonAxis/2
public override Vector2 GetButtonAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
- Parameters
ButtonTypes buttonType
- The type of button to check for the axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button axis on.
- Returns
Vector2
- A Vector2 of the X/Y values of the button axis. If no axis values exist for the given button, then a Vector2.Zero is returned.
The GetButtonAxis method retrieves the current X/Y axis values for the given button type on the given controller reference.
GetButtonSenseAxis/2
public override float GetButtonSenseAxis(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
- Parameters
ButtonTypes buttonType
- The type of button to check for the sense axis on.VRTK_ControllerReference controllerReference
- The reference to the controller to check the sense axis on.
- Returns
float
- The current sense axis value.
The GetButtonSenseAxis method retrieves the current sense axis value for the given button type on the given controller reference.
GetButtonHairlineDelta/2
public override float GetButtonHairlineDelta(ButtonTypes buttonType, VRTK_ControllerReference controllerReference)
- Parameters
ButtonTypes buttonType
- The type of button to get the hairline delta for.VRTK_ControllerReference controllerReference
- The reference to the controller to get the hairline delta for.
- Returns
float
- The delta between the button presses.
The GetButtonHairlineDelta method is used to get the difference between the current button press and the previous frame button press.
GetControllerButtonState/3
public override bool GetControllerButtonState(ButtonTypes buttonType, ButtonPressTypes pressType, VRTK_ControllerReference controllerReference)
- Parameters
ButtonTypes buttonType
- The type of button to check for the state of.ButtonPressTypes pressType
- The button state to check for.VRTK_ControllerReference controllerReference
- The reference to the controller to check the button state on.
- Returns
bool
- Returns true if the given button is in the state of the given press type on the given controller reference.
The GetControllerButtonState method is used to determine if the given controller button for the given press type on the given controller reference is currently taking place.
Updated less than a minute ago