UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IMotionController Class Referenceabstract

#include <IMotionController.h>

+ Inheritance diagram for IMotionController:

Public Member Functions

virtual ~IMotionController ()
 
virtual FName GetMotionControllerDeviceTypeName () const =0
 
virtual bool GetControllerOrientationAndPosition (const int32 ControllerIndex, const FName MotionSource, FRotator &OutOrientation, FVector &OutPosition, float WorldToMetersScale) const =0
 
virtual bool GetControllerOrientationAndPosition (const int32 ControllerIndex, const FName MotionSource, FRotator &OutOrientation, FVector &OutPosition, bool &OutbProvidedLinearVelocity, FVector &OutLinearVelocity, bool &OutbProvidedAngularVelocity, FVector &OutAngularVelocityAsAxisAndLength, bool &OutbProvidedLinearAcceleration, FVector &OutLinearAcceleration, float WorldToMetersScale) const =0
 
virtual bool GetControllerOrientationAndPositionForTime (const int32 ControllerIndex, const FName MotionSource, FTimespan Time, bool &OutTimeWasUsed, FRotator &OutOrientation, FVector &OutPosition, bool &OutbProvidedLinearVelocity, FVector &OutLinearVelocity, bool &OutbProvidedAngularVelocity, FVector &OutAngularVelocityAsAxisAndLength, bool &OutbProvidedLinearAcceleration, FVector &OutLinearAcceleration, float WorldToMetersScale) const =0
 
virtual ETrackingStatus GetControllerTrackingStatus (const int32 ControllerIndex, const FName MotionSource) const =0
 
virtual void EnumerateSources (TArray< FMotionControllerSource > &SourcesOut) const =0
 
virtual float GetCustomParameterValue (const FName MotionSource, FName ParameterName, bool &bOutValueFound) const =0
 
virtual bool GetHandJointPosition (const FName MotionSource, int jointIndex, FVector &OutPosition) const =0
 
virtual bool SetEnhancedInputUserSettings (TObjectPtr< class UEnhancedInputUserSettings > InputSettings=nullptr)
 
virtual bool AttachInputMappingContexts (const TSet< TObjectPtr< class UInputMappingContext > > &InputMappingContexts)
 

Static Public Member Functions

static FName GetModularFeatureName ()
 
static FRotator AngularVelocityAsAxisAndLengthToRotator (const FVector AngularVelocityAsAxisAndLength)
 
static HEADMOUNTEDDISPLAY_API bool GetHandEnumForSourceName (const FName Source, EControllerHand &OutHand)
 

Static Public Attributes

static FName FeatureName = FName(TEXT("MotionController"))
 
static HEADMOUNTEDDISPLAY_API FName LeftHandSourceId
 
static HEADMOUNTEDDISPLAY_API FName RightHandSourceId
 
static HEADMOUNTEDDISPLAY_API FName HMDSourceId
 
static HEADMOUNTEDDISPLAY_API FName HeadSourceId
 

Detailed Description

Motion Controller device interface

NOTE: This intentionally does NOT derive from IInputDeviceModule, to allow a clean separation for devices which exclusively track motion with no tactile input NOTE: You must MANUALLY call IModularFeatures::Get().RegisterModularFeature( GetModularFeatureName(), this ) in your implementation! This allows motion controllers to be both piggy-backed off HMD devices which support them, as well as standing alone.

Constructor & Destructor Documentation

◆ ~IMotionController()

virtual IMotionController::~IMotionController ( )
inlinevirtual

Member Function Documentation

◆ AngularVelocityAsAxisAndLengthToRotator()

static FRotator IMotionController::AngularVelocityAsAxisAndLengthToRotator ( const FVector  AngularVelocityAsAxisAndLength)
inlinestatic

◆ AttachInputMappingContexts()

virtual bool IMotionController::AttachInputMappingContexts ( const TSet< TObjectPtr< class UInputMappingContext > > &  InputMappingContexts)
inlinevirtual

Add input mapping contexts to the motion controller. This allows the motion controller to support Enhanced Input actions.

Parameters
MappingContextsThe set of input mapping contexts used with motion controllers
Returns
False if the input mapping contexts can't be attached to the session, true otherwise

◆ EnumerateSources()

virtual void IMotionController::EnumerateSources ( TArray< FMotionControllerSource > &  SourcesOut) const
pure virtual

Called to request the motion sources that this IMotionController provides

Parameters
SourcesA motion source enumerator object that IMotionControllers can add source names to

◆ GetControllerOrientationAndPosition() [1/2]

virtual bool IMotionController::GetControllerOrientationAndPosition ( const int32  ControllerIndex,
const FName  MotionSource,
FRotator OutOrientation,
FVector OutPosition,
bool OutbProvidedLinearVelocity,
FVector OutLinearVelocity,
bool OutbProvidedAngularVelocity,
FVector OutAngularVelocityAsAxisAndLength,
bool OutbProvidedLinearAcceleration,
FVector OutLinearAcceleration,
float  WorldToMetersScale 
) const
pure virtual

Returns the calibration-space orientation of the requested controller's hand.

Parameters
ControllerIndexThe Unreal controller (player) index of the controller set
MotionSourceWhich source, within the motion controller to get the orientation and position for
OutOrientation(out) If tracked, the orientation (in calibrated-space) of the controller in the specified hand
OutPosition(out) If tracked, the position (in calibrated-space) of the controller in the specified hand
OutbProvidedLinearVelocity(out) True if linear velocity was provided.
OutLinearVelocity(out) The Linear velocity of the controller.
OutbProvidedAngularVelocity(out) True if angular velocity was provided.
OutAngularVelocityAsAxisAndLength(out) The angular velocity of the controller represented as an axis of rotation who's magnitude is the velocity in radians per second. See UHeadMountedDisplayFunctionLibrary::GetControllerTransformForTime2 for an example of how this can be turned into an FRotator without losing rotation speed beyond 180 degrees/second.
OutbProvidedLinearAcceleration(out) True if linear acceleration was provided.
OutLinearAcceleration(out) The Linear acceleration of the controller.
WorldToMetersScaleThe world scaling factor.
Returns
True if the device requested is valid and tracked, false otherwise

◆ GetControllerOrientationAndPosition() [2/2]

virtual bool IMotionController::GetControllerOrientationAndPosition ( const int32  ControllerIndex,
const FName  MotionSource,
FRotator OutOrientation,
FVector OutPosition,
float  WorldToMetersScale 
) const
pure virtual

Returns the calibration-space orientation of the requested controller's hand.

Parameters
ControllerIndexThe Unreal controller (player) index of the controller set
MotionSourceWhich source, within the motion controller to get the orientation and position for
OutOrientation(out) If tracked, the orientation (in calibrated-space) of the controller in the specified hand
OutPosition(out) If tracked, the position (in calibrated-space) of the controller in the specified hand
WorldToMetersScaleThe world scaling factor.
Returns
True if the device requested is valid and tracked, false otherwise

◆ GetControllerOrientationAndPositionForTime()

virtual bool IMotionController::GetControllerOrientationAndPositionForTime ( const int32  ControllerIndex,
const FName  MotionSource,
FTimespan  Time,
bool OutTimeWasUsed,
FRotator OutOrientation,
FVector OutPosition,
bool OutbProvidedLinearVelocity,
FVector OutLinearVelocity,
bool OutbProvidedAngularVelocity,
FVector OutAngularVelocityAsAxisAndLength,
bool OutbProvidedLinearAcceleration,
FVector OutLinearAcceleration,
float  WorldToMetersScale 
) const
pure virtual

Returns the calibration-space orientation of the requested controller's hand at the specified time for potentially improved temporal precision, particularly fetching the controller transform when a button was pressed on a platform that provides sub-frame timing for button presses. This is only intended to work with times very near the current frame. In general it should be called immediatly after receiving the button press. On many platforms this functionality is not supported and this function will set OutTimeWasUsed to false and then call GetControllerOrientationAndPosition, ignoring Time.

Parameters
ControllerIndexThe Unreal controller (player) index of the controller set
MotionSourceWhich source, within the motion controller to get the orientation and position for
TimeThe time at which we would like to query the orientation.
OutTimeWasUsed(out) If true the time was used somehow to give a more temporally relevant orientation. If false the time was ignored and a cached value returned.
OutOrientation(out) If tracked, the orientation (in calibrated-space) of the controller in the specified hand
OutPosition(out) If tracked, the position (in calibrated-space) of the controller in the specified hand
OutbProvidedLinearVelocity(out) True if linear velocity was provided.
OutLinearVelocity(out) The Linear velocity of the controller.
OutbProvidedAngularVelocity(out) True if angular velocity was provided.
OutAngularVelocityAsAxisAndLength(out) The angular velocity of the controller represented as an axis of rotation who's magnitude is the velocity in radians per second. See UHeadMountedDisplayFunctionLibrary::GetControllerTransformForTime2 for an example of how this can be turned into an FRotator without losing rotation speed beyond 180 degrees/second.
OutbProvidedLinearAcceleration(out) True if linear acceleration was provided.
OutLinearAcceleration(out) The Linear acceleration of the controller.
WorldToMetersScaleThe world scaling factor.
Returns
True if the device requested is valid and tracked, false otherwise

◆ GetControllerTrackingStatus()

virtual ETrackingStatus IMotionController::GetControllerTrackingStatus ( const int32  ControllerIndex,
const FName  MotionSource 
) const
pure virtual

Returns the tracking status (e.g. not tracked, intertial-only, fully tracked) of the specified controller

Returns
Tracking status of the specified controller, or ETrackingStatus::NotTracked if the device is not found

◆ GetCustomParameterValue()

virtual float IMotionController::GetCustomParameterValue ( const FName  MotionSource,
FName  ParameterName,
bool bOutValueFound 
) const
pure virtual

Returns a custom names parameter value

Parameters
MotionSourceThe name of the motion source we want parameters for
ParameterNameThe specific value we are looking for
bOutValueFound(out) Whether the parameter could be found
Returns
The value of the parameter

◆ GetHandEnumForSourceName()

bool IMotionController::GetHandEnumForSourceName ( const FName  Source,
EControllerHand OutHand 
)
static

◆ GetHandJointPosition()

virtual bool IMotionController::GetHandJointPosition ( const FName  MotionSource,
int  jointIndex,
FVector OutPosition 
) const
pure virtual

◆ GetModularFeatureName()

static FName IMotionController::GetModularFeatureName ( )
inlinestatic

◆ GetMotionControllerDeviceTypeName()

virtual FName IMotionController::GetMotionControllerDeviceTypeName ( ) const
pure virtual

Returns the device type of the controller.

Returns
Device type of the controller.

◆ SetEnhancedInputUserSettings()

virtual bool IMotionController::SetEnhancedInputUserSettings ( TObjectPtr< class UEnhancedInputUserSettings InputSettings = nullptr)
inlinevirtual

Add a set of enhanced input user settings to the motion controller. This allows the motion controller to support Enhanced Input actions.

Parameters
InputConfigThe path to the enhanced user input settings asset
Returns
False if the input config can't be attached to the session, true otherwise

Member Data Documentation

◆ FeatureName

FName IMotionController::FeatureName = FName(TEXT("MotionController"))
inlinestatic

◆ HeadSourceId

FName IMotionController::HeadSourceId
static

◆ HMDSourceId

FName IMotionController::HMDSourceId
static

◆ LeftHandSourceId

FName IMotionController::LeftHandSourceId
static

◆ RightHandSourceId

FName IMotionController::RightHandSourceId
static

The documentation for this class was generated from the following files: