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

OVRControllerBase Class

Provides the base class for instances representing specific types of physical controllers (OVRControllerGamepadPC, OVRControllerTouch, etc.).
The primary purpose of this type is to encapsulate input mappings allowing inputs from various controller types to be interpreted appropriately. Descendant types are thus expected to use their abstract method overrides (such as of ConfigureButtonMap) to initialize input mappings to reasonable defaults for the control scheme being implemented.

Fields

The controller type (gamepad, Oculus Touch, etc.) of the physical controller represented by this instance.
This value is typically set by a descendant type of OVRControllerBase during construction.
The VirtualButtonMap characterizing how physical button inputs should be mapped to RawButton states as appropriate to this control scheme.
This mapping should be initialized during construction by the implementation of ConfigureButtonMap.
The VirtualTouchMap characterizing how physical touch inputs should be mapped to RawTouch states as appropriate to this control scheme.
This mapping should be initialized during construction by the implementation of ConfigureTouchMap.
The VirtualNearTouchMap characterizing how physical proximity inputs should be mapped to RawNearTouch states as appropriate to this control scheme.
This mapping should be initialized during construction by the implementation of ConfigureNearTouchMap.
The VirtualAxis1DMap characterizing how physical single-axis inputs should be mapped to RawAxis1D states as appropriate to this control scheme.
This mapping should be initialized during construction by the implementation of ConfigureAxis1DMap.
The VirtualAxis2DMap characterizing how physical two-axis inputs should be mapped to RawAxis2D states as appropriate to this control scheme.
This mapping should be initialized during construction by the implementation of ConfigureAxis2DMap.
The previous state (prior to the most recent Update of the this controller.
This data can be used by polling logic to determine whether state has changed. The data is updated automatically as part of the instance's Update.
The current state (as of the most recent Update of the this controller.
This data can be used directly to observe the current state or compared with previousState to determine whether state has changed. The data is updated automatically as part of the instance's Update.
Determines whether a "dead zone" should be applied to suppress small values of one- and two-axis inputs.
It is possible to set this value manually; however, there is internal logic which can set this value on its own under certain circumstances, in which case the manually-set value may be overridden without warning.

Member Functions

Basic constructor responsible for initializing input mappings.
This is done by invoking the configuration methods (ConfigureButtonMap, ConfigureTouchMap, etc.), which descendant types should use to appropriately initialize the respective input mappings (buttonMap, touchMap, etc.).
Updates this instance by reading inputs from the underlying system, reinterpreting them as specified by the input maps (buttonMap, touchMap, etc.), and updating the information in currentState and previousState.
Returns
An enum bit mask indicating whether a controller of controllerType is currently connected
Sets the vibration of the physical controller represented by this instance.
Parameters
frequency
The frequency of the desired vibration
amplitude
The amplitude of the desired vibration
Sets the localized vibration of the physical controller represented by this instance.
Parameters
hapticsLocationMask
A mask indicating the locations to which this vibration should apply
frequency
The frequency of the desired vibration
amplitude
The amplitude of the desired vibration
Sets the HapticsAmplitudeEnvelopeVibration for the physical controller represented by this instance.
Parameters
hapticsVibration
The desired haptics amplitude envelope vibration
Sets the HapticsPcmVibration for the physical controller represented by this instance.
Parameters
hapticsVibration
The desired PCM vibration to be sent to the system
Returns
The number of samples consumed by the resulting native invocation
Retrieves the hardware sampling rate of the physical controller represented by this instance.
Returns
The sampling rate, in hertz
Deprecated
Retrieves the current estimated battery power remaining for the current control scheme.
Returns
The estimated battery power remaining as a percentage of the maximum
Initializes the buttonMap to appropriate default values for the control scheme encapsulated in this instance.
This method is invoked automatically during initialization and need not be separately invoked except to restore the defaults from a modified state.
Initializes the touchMap to appropriate default values for the control scheme encapsulated in this instance.
This method is invoked automatically during initialization and need not be separately invoked except to restore the defaults from a modified state.
Initializes the nearTouchMap to appropriate default values for the control scheme encapsulated in this instance.
This method is invoked automatically during initialization and need not be separately invoked except to restore the defaults from a modified state.
Initializes the axis1DMap to appropriate default values for the control scheme encapsulated in this instance.
This method is invoked automatically during initialization and need not be separately invoked except to restore the defaults from a modified state.
Initializes the axis2DMap to appropriate default values for the control scheme encapsulated in this instance.
This method is invoked automatically during initialization and need not be separately invoked except to restore the defaults from a modified state.
Wrapper method which invokes the VirtualButtonMap.ToRawMask(Button) method of this instance's buttonMap.
Parameters
virtualMask
The observed inputs to be remapped
Returns
A remapping of virtualMask as specified by buttonMap
Wrapper method which invokes the VirtualTouchMap.ToRawMask(Touch) method of this instance's touchMap.
Parameters
virtualMask
The observed inputs to be remapped
Returns
A remapping of virtualMask as specified by touchMap
Wrapper method which invokes the VirtualNearTouchMap.ToRawMask(NearTouch) method of this instance's nearTouchMap.
Parameters
virtualMask
The observed inputs to be remapped
Returns
A remapping of virtualMask as specified by nearTouchMap
Wrapper method which invokes the VirtualAxis1DMap.ToRawMask(Axis1D) method of this instance's axis1DMap.
Parameters
virtualMask
The observed inputs to be remapped
Returns
A remapping of virtualMask as specified by axis1DMap
Wrapper method which invokes the VirtualAxis2DMap.ToRawMask(Axis2D) method of this instance's axis2DMap.
Parameters
virtualMask
The observed inputs to be remapped
Returns
A remapping of virtualMask as specified by axis2DMap
Did you find this page helpful?
Thumbs up icon
Thumbs down icon