UHeadMountedDisplayFunctionLibrary

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

HeadMountedDisplay

Header

/Engine/Source/Runtime/HeadMountedDisplay/Public/HeadMountedDisplayFunctionLibrary.h

Include

#include "HeadMountedDisplayFunctionLibrary.h"

Syntax

class UHeadMountedDisplayFunctionLibrary : public UBlueprintFunctionLibrary

Constructors

Name Description

Public function

UHeadMountedDisplayFunctionLibrary

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Static

void

 

BreakKey

(
    FKey InKey,
    FString& InteractionProfile,
    EControllerHand& Hand,
    FName& MotionSource,
    FString& Indentifier,
    FString& Component
)

Breaks an XR key apart into the interaction profile, handedness, motion source, indentifier and component.

Public function Static

void

 

CalibrateExternalTrackingToHMD

(
    const FTransform& ExternalTracking...
)

Called to calibrate the offset transform between an external tracking source and the internal tracking source (e.g. mocap tracker to and HMD tracker).

Public function Static

void

 

ClearXRTimedInputActionDelegate

(
    const FName& ActionPath
)

Public function Static

bool

 

ConfigureGestures

(
    const FXRGestureConfig& GestureCon...
)

Public function Static

EXRDeviceCon...

 

ConnectRemoteXRDevice

(
    const FString& IpAddress,
    const int32 BitRate
)

Connect to a remote device

Connect to a remote device for Remote Debugging

Public function Static

void

 

DisconnectRemoteXRDevice()

Disconnect remote AR Device

Public function Static

bool

 

EnableHMD

(
    bool bEnable
)

Switches to/from using HMD and stereo rendering.

Public function Static

void

 

EnableLowPersistenceMode

(
    bool bEnable
)

Switches between low and full persistence modes.

Public function Static

TArray< FXRD...

 

EnumerateTrackedDevices

(
    const FName SystemId,
    EXRTrackedDeviceType DeviceType
)

Cross XR-System query that will list all XR devices currently being tracked.

Public function Static

bool

 

GetControllerTransformForTime

(
    UObject* WorldContext,
    const int32 ControllerIndex,
    const FName MotionSource,
    FTimespan Time,
    bool& bTimeWasUsed,
    FRotator& Orientation,
    FVector& Position,
    bool& bProvidedLinearVelocity,
    FVector& LinearVelocity,
    bool& bProvidedAngularVelocity,
    FVector& AngularVelocityRadPerSec,
    bool& bProvidedLinearAcceleration,
    FVector& LinearAcceleration
)

Get the transform and potentially velocity data at a specified time near the current frame in unreal world space.

Public function Static

void

 

GetDevicePose

(
    const FXRDeviceId& XRDeviceId,
    bool& bIsTracked,
    FRotator& Orientation,
    bool& bHasPositionalTracking,
    FVector& Position
)

Cross XR-System query that returns a specific device's tracked position and orientation (in tracking space).

Public function Static

void

 

GetDeviceWorldPose

(
    UObject* WorldContext,
    const FXRDeviceId& XRDeviceId,
    bool& bIsTracked,
    FRotator& Orientation,
    bool& bHasPositionalTracking,
    FVector& Position
)

Cross XR-System query that returns a specific device's position and orientation in world space.

Public function Static

void

 

GetHMDData

(
    UObject* WorldContext,
    FXRHMDData& HMDData
)

Cross XR-System query that returns critical information about the HMD display (position, orientation, device name)

Public function Static

FName

 

GetHMDDeviceName()

Returns the name of the device, so scripts can modify their behaviour appropriately

Public function Static

EHMDWornStat...

 

GetHMDWornState()

Returns the worn state of the device.

Public function Static

void

 

GetMotionControllerData

(
    UObject* WorldContext,
    const EControllerHand Hand,
    FXRMotionControllerData& MotionCon...
)

Cross XR-System query that returns critical information about the motion controller (position, orientation, hand/finger position)

Public function Static

int32

 

GetNumOfTrackingSensors()

If the HMD has multiple positional tracking sensors, return a total number of them currently connected.

Public function Static

void

 

GetOrientationAndPosition

(
    FRotator& DeviceRotation,
    FVector& DevicePosition
)

Grabs the current orientation and position for the HMD.

Public function Static

float

 

GetPixelDensity()

Returns the current VR pixel density.

Public function Static

FVector2D

 

GetPlayAreaBounds

Get the bounds of the area where the user can freely move while remaining tracked centered around the specified origin

Public function Static

void

 

GetPositionalTrackingCameraParameters

(
    FVector& CameraOrigin,
    FRotator& CameraRotation,
    float& HFOV,
    float& VFOV,
    float& CameraDistance,
    float& NearPlane,
    float& FarPlane
)

If the HMD has a positional sensor, this will return the game-world location of it, as well as the parameters for the bounding region of tracking.

Public function Static

TEnumAsByte<...

 

GetTrackingOrigin()

Returns current tracking origin type (eye level or floor level).

Public function Static

void

 

GetTrackingSensorParameters

(
    FVector& Origin,
    FRotator& Rotation,
    float& LeftFOV,
    float& RightFOV,
    float& TopFOV,
    float& BottomFOV,
    float& Distance,
    float& NearPlane,
    float& FarPlane,
    bool& IsActive,
    int32 Index
)

If the HMD has a positional sensor, this will return the game-world location of it, as well as the parameters for the bounding region of tracking.

Public function Static

FTransform

 

GetTrackingToWorldTransform

(
    UObject* WorldContext
)

Returns a transform that can be used to convert points from tracking space to world space.

Public function Static

FString

 

GetVersionString()

Returns name of tracking system specific version string.

Public function Static

void

 

GetVRFocusState

(
    bool& bUseFocus,
    bool& bHasFocus
)

Returns current state of VR focus.

Public function Static

float

 

GetWorldToMetersScale

(
    UObject* WorldContext
)

Returns the World to Meters scale, which corresponds to the scale of the world as perceived by the player

Public function Static

int32

 

GetXRSystemFlags()

Returns the flags for the device, so scripts can modify their behaviour appropriately

Public function Static

bool

 

HasValidTrackingPosition()

If the HMD supports positional tracking, whether or not we are currently being tracked

Public function Static

bool

 

IsDeviceTracking

(
    const FXRDeviceId& XRDeviceId
)

Cross XR-System query that returns whether the specified device is tracked or not.

Public function Static

bool

 

IsHeadMountedDisplayConnected()

Returns whether or not the HMD hardware is connected and ready to use.

Public function Static

bool

 

IsHeadMountedDisplayEnabled()

Returns whether or not we are currently using the head mounted display.

Public function Static

bool

 

IsInLowPersistenceMode()

Returns true, if HMD is in low persistence mode. 'false' otherwise.

Public function Static

bool

 

IsSpectatorScreenModeControllable()

Return true if spectator screen mode control is available.

Public function Static

void

 

ResetOrientationAndPosition

(
    float Yaw,
    EOrientPositionSelector::Type Optio...
)

Resets orientation by setting roll and pitch to 0, assuming that current yaw is forward direction and assuming current position as a 'zero-point' (for positional tracking).

Public function Static

void

 

SetClippingPlanes

(
    float Near,
    float Far
)

Sets near and far clipping planes (NCP and FCP) for stereo rendering.

Public function Static

void

 

SetSpectatorScreenMode

(
    ESpectatorScreenMode Mode
)

Sets the social screen mode.

Public function Static

void

 

SetSpectatorScreenModeTexturePlusEyeLayout

(
    FVector2D EyeRectMin,
    FVector2D EyeRectMax,
    FVector2D TextureRectMin,
    FVector2D TextureRectMax,
    bool bDrawEyeFirst,
    bool bClearBlack,
    bool bUseAlpha
)

Setup the layout for ESpectatorScreenMode::TexturePlusEye.

Public function Static

void

 

SetSpectatorScreenTexture

(
    UTexture* InTexture
)

Change the texture displayed on the social screen

Public function Static

void

 

SetTrackingOrigin

Sets current tracking origin type (eye level or floor level).

Public function Static

void

 

SetWorldToMetersScale

(
    UObject* WorldContext,
    float NewScale
)

Sets the World to Meters scale, which changes the scale of the world as perceived by the player

Public function Static

void

 

SetXRDisconnectDelegate

(
    const FXRDeviceOnDisconnectDelegate...
)

Public function Static

void

 

SetXRTimedInputActionDelegate

(
    const FName& ActionName,
    const FXRTimedInputActionDelegate&...
)

Hook up a delegate to get an OpenXR action event with action time.

Public function Static

void

 

UpdateExternalTrackingHMDPosition

(
    const FTransform& ExternalTracking...
)

Called after calibration to attempt to pull the internal tracker (e.g. HMD tracking) in line with the external tracker (e.g. mocap tracker).

Constants

Deprecated Functions

Name Description

Public function Static

float

 

GetScreenPercentage()

Use GetPixelDensity instead