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

OVRControllerHelper Class

Extends MonoBehaviour, 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

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.
The root GameObject that represents the prefab for the Oculus Touch for Quest And RiftS Controller model (Right).
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.
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.
The root GameObject that represents the prefab for the Oculus Touch for Quest 2 Controller model (Left).
The root GameObject that represents the Oculus Touch for Quest 2 Controller model (Right).
The root GameObject that represents the prefab that controls the Meta Touch Pro Controller model (Left).
The root GameObject that represents the prefab for the Meta Touch Pro Controller model (Right).
The root GameObject that represents the prefab for Meta Quest Plus Controller model (Left).
The root GameObject that represents the Meta Quest Plus Controller model (Right).
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.
Determines if the controller should be hidden based on held state.
But default, this value is set to OVRInput.InputDeviceShowState.ControllerInHandOrNoHand.
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.
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.

Member Functions

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.
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.
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.
Returns
True if the primary index trigger is down, false otherwise
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.
Returns
True if the primary index trigger is up, false otherwise
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.
Returns
The source transform for raycasts from the associated controller
Checks whether or not this OVRControllerHelper instance has been Destroyed; a convenience wrapper around the Unity idiomatic this != null check.
Returns
True if this instance has been Destroyed, false otherwise
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.
Returns
True if the associated controller is active, false otherwise
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.
Returns
OVRPlugin.Hand.HandLeft if the associated controller is OVRInput.Controller.LTouch, otherwise returns OVRPlugin.Hand.HandRight.
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.
Parameters
rayData
The OVRInputRayData to be provided to the ray helper
Did you find this page helpful?
Thumbs up icon
Thumbs down icon