API reference

ControllerRef Class

Extends MonoBehaviour
ControllerRef is a utility component that delegates all of its IController implementation to the provided Controller object.

Properties

Active : bool
[Get]
Evaluates the current state of the component and returns whether it is active.
The logic for determining the active state is defined by the implementing class. This method is typically used in interaction scripts to check whether a certain condition is met before triggering an event or action. For example implementations, please refer to HandActiveState.Active and ActiveStateGroup.Active.
Signature
bool Active
ControllerInput : ControllerInput
[Get]
Retrieves a Input.ControllerInput which can be used to query the state of the buttons, thumbsticks, and other input modalities available on the controller.
Signature
ControllerInput ControllerInput
Handedness : Handedness
[Get]
Indicates whether the tracked controller is Handedness.Left- or Handedness.Right-handed.
Signature
Handedness Handedness
IsConnected : bool
[Get]
Indicates whether the controller is available and has valid data.
Note that, because this reflects both the general availability and present validity of controller data, this value can vary from frame to frame depending on whether the system is currently able to track the controller. This is a valid API to check in order to determine whether up-to-date controller data is available at a given moment.
Signature
bool IsConnected
IsPoseValid : bool
[Get]
Indicates whether the controller is currently being tracked by the system such that valid poses for it can be retrieved.
Signature
bool IsPoseValid
Scale : float
[Get]
Indicates the expected scale of the controller in world space.
Under most circumstances, this scale is 1; however, if the tracking space has been scaled relative to world space, that scaling will be reflected in this value.
Signature
float Scale
WhenUpdated : Action
Event indicating that the controller has been updated and can now be queried for potentially new data.
Signature
Action WhenUpdated

Protected Methods

Awake ()
Signature
virtual void Awake()
Returns
void
Start ()
Signature
virtual void Start()
Returns
void

Methods

InjectAllControllerRef ( controller )
Signature
void InjectAllControllerRef(IController controller)
Parameters
controller: IController
Returns
void
InjectController ( controller )
Signature
void InjectController(IController controller)
Parameters
controller: IController
Returns
void
IsButtonUsageAllActive ( buttonUsage )
Batch query method for determining whether all of a set of buttons (characterized by a bit mask of ControllerButtonUsage) are currently active.
Signature
bool IsButtonUsageAllActive(ControllerButtonUsage buttonUsage)
Parameters
buttonUsage: ControllerButtonUsage  The bit mask indicating which buttons are part of the query
Returns
bool  True if all of the queried buttons are active, false otherwise
IsButtonUsageAnyActive ( buttonUsage )
Batch query method for determining whether any within a set of buttons (characterized by a bit mask of ControllerButtonUsage) is currently active.
Signature
bool IsButtonUsageAnyActive(ControllerButtonUsage buttonUsage)
Parameters
buttonUsage: ControllerButtonUsage  The bit mask indicating which buttons are part of the query
Returns
bool  True if any of the queried buttons are active, false otherwise
TryGetPointerPose ( pose )
Attempts to return a valid "pointer pose" for the controller.
A "pointer pose" is a world-space pose (position and orientation) intended to be used as a directional input, conceptually comparable to "pointing at something." Typically, individual controllers provide their own "pointer pose" based on the ergonomics of the device; this method provides a unified way to query for this.
Signature
bool TryGetPointerPose(out Pose pose)
Parameters
pose: out Pose  A valid world-space pointer pose if one could be calculated, identity otherwise
Returns
bool  True if the pose argument was populated with a valid pointer pose, false otherwise
TryGetPose ( pose )
Attempts to retrieve the pose of the controller in world space.
The exact relationship of the retrieved pose to the physical position of the controller can vary by platform, but it typically corresponds to the root transform of the intended visual affordance for the physical controller being tracked.
Signature
bool TryGetPose(out Pose pose)
Parameters
pose: out Pose  A void world space pose for the controller if available, identity otherwise
Returns
bool  True if the pose argument was populated with a valid pose, false otherwise