API reference
API reference
Select your platform
No SDKs available
No versions available

OVRControllerHelper Class

Extends MonoBehaviour, OVRInputModule.InputSource
Helper script for managing the rendering of a controller.
This script takes into account the ControllerType of the associated physical controller, initializes the correct assets, manages animation, and hides the visuals when the controller is disconnected.
You can assign new prefabs to the model fields to control which prefab represents the given controller type, though replacement prefabs must be very carefully constructed to fulfill all requirements.

Fields

m_controller : OVRInput.Controller
The OVRInput.Controller that should be reflected by the rendered assets.
OVRControllerHelper queries OVRInput and the underlying system for the appropriate controller data depending on the controller specified in this setting.
Signature
OVRInput.Controller m_controller
m_modelMetaTouchPlusLeftController : GameObject
The root GameObject that represents the prefab for Meta Quest Plus Controller model (Left).
Signature
GameObject m_modelMetaTouchPlusLeftController
m_modelMetaTouchPlusRightController : GameObject
The root GameObject that represents the Meta Quest Plus Controller model (Right).
Signature
GameObject m_modelMetaTouchPlusRightController
m_modelMetaTouchProLeftController : GameObject
The root GameObject that represents the prefab that controls the Meta Touch Pro Controller model (Left).
Signature
GameObject m_modelMetaTouchProLeftController
m_modelMetaTouchProRightController : GameObject
The root GameObject that represents the prefab for the Meta Touch Pro Controller model (Right).
Signature
GameObject m_modelMetaTouchProRightController
m_modelOculusTouchQuest2LeftController : GameObject
The root GameObject that represents the prefab for the Oculus Touch for Quest 2 Controller model (Left).
Signature
GameObject m_modelOculusTouchQuest2LeftController
m_modelOculusTouchQuest2RightController : GameObject
The root GameObject that represents the Oculus Touch for Quest 2 Controller model (Right).
Signature
GameObject m_modelOculusTouchQuest2RightController
m_modelOculusTouchQuestAndRiftSLeftController : GameObject
The root GameObject that represents the prefab that controls the Oculus Touch for Quest And RiftS Controller model (Left).
You can assign this field from the Unity Editor to control which prefab is used to represent this controller type.
Signature
GameObject m_modelOculusTouchQuestAndRiftSLeftController
m_modelOculusTouchQuestAndRiftSRightController : GameObject
The root GameObject that represents the prefab for the Oculus Touch for Quest And RiftS Controller model (Right).
Signature
GameObject m_modelOculusTouchQuestAndRiftSRightController
m_modelOculusTouchRiftLeftController : GameObject
The root GameObject that represents the prefab that controls the Oculus Touch for Rift Controller model (Left).
This field can be assigned from the Unity Editor to control which prefab is used to represent this controller type.
Signature
GameObject m_modelOculusTouchRiftLeftController
m_modelOculusTouchRiftRightController : GameObject
The root GameObject that represents the prefab that controls the Oculus Touch for Rift Controller model (Right).
This field can be assigned from the Unity Editor to control which prefab is used to represent this controller type.
Signature
GameObject m_modelOculusTouchRiftRightController
m_showState : OVRInput.InputDeviceShowState
Determines if the controller should be hidden based on held state.
But default, this value is set to OVRInput.InputDeviceShowState.ControllerInHandOrNoHand.
Signature
OVRInput.InputDeviceShowState m_showState
RayHelper : OVRRayHelper
An optional component for providing basic shell-like ray interaction functionality, highlighting where you're selecting in the UI and responding to pinches / button presses.
Signature
OVRRayHelper RayHelper
showWhenHandsArePoweredByNaturalControllerPoses : bool
If controller-driven hand poses is on, and the mode is Natural, controllers will be hidden unless this is true; in other words, enabling this setting will cause the controller visuals to be rendered while controller-driven hands are enabled in Natural mode.
Signature
bool showWhenHandsArePoweredByNaturalControllerPoses

Methods

GetHand ()
Queries the handedness of an associated Oculus Touch controller.
Because this method only checks for equivalency to OVRInput.Controller.LTouch, it cannot be used to accurately query the handedness of non-Oculus Touch controllers as, even for OVRInput.Controller.LHand, it will return OVRPlugin.Hand.HandRight.
Signature
OVRPlugin.Hand GetHand()
Returns
OVRPlugin.Hand  OVRPlugin.Hand.HandLeft if the associated controller is OVRInput.Controller.LTouch, otherwise returns OVRPlugin.Hand.HandRight.
GetPointerRayTransform ()
Retrieves the Unity Transform which should be used as the origin of raycasts from the associated controller.
Specifically, raycasts should begin at the position and proceed in the forward direction of the returned transform.
Signature
Transform GetPointerRayTransform()
Returns
Transform  The source transform for raycasts from the associated controller
InputFocusAquired ()
Sets the associated controller to have input focus.
This is typically invoked in response to a button press or other clearly-intentional input and is used for purposes such as showing pointer rays, etc.
Signature
void InputFocusAquired()
Returns
void
InputFocusLost ()
Sets the associated controller to not have input focus.
This is typically invoked in response to a button press or other clearly-intentional input on a different controller and is used for purposes such as hiding pointer rays, etc.
Signature
void InputFocusLost()
Returns
void
IsActive ()
Checks whether the associated controller is considered to be "active," i.e.
in use. Unrelated to Unity's built-in Behaviour.isActiveAndEnabled property or any other Unity-related concept of activity.
Signature
bool IsActive()
Returns
bool  True if the associated controller is active, false otherwise
IsPressed ()
Checks whether the state of the associated controller is "pressed," a convenience wrapper around checking OVRInput.GetDown(OVRInput.Button, OVRInput.Controller) on the OVRInput.Button.PrimaryIndexTrigger.
Signature
bool IsPressed()
Returns
bool  True if the primary index trigger is down, false otherwise
IsReleased ()
Checks whether the state of the associated controller is "released," a convenience wrapper around checking OVRInput.GetUp(OVRInput.Button, OVRInput.Controller) on the OVRInput.Button.PrimaryIndexTrigger.
Signature
bool IsReleased()
Returns
bool  True if the primary index trigger is up, false otherwise
IsValid ()
Checks whether or not this OVRControllerHelper instance has been Destroyed; a convenience wrapper around the Unity idiomatic this != null check.
Signature
bool IsValid()
Returns
bool  True if this instance has been Destroyed, false otherwise
UpdatePointerRay ( rayData )
If RayHelper is set, applies the provided OVRInputRayData to that helper and sets its activation and strength based on the OVRInput.Button.PrimaryIndexTrigger of the associated controller.
Does nothing if RayHelper is null.
Signature
void UpdatePointerRay(OVRInputRayData rayData)
Parameters
rayData: OVRInputRayData  The OVRInputRayData to be provided to the ray helper
Returns
void