HMD

HMD

#Overview

name: HMD

This variable is created as a Console Variable (cvar).

It is referenced in 39 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of the HMD variable is to represent a Head-Mounted Display device in the Unreal Engine ecosystem. It is primarily used for Virtual Reality (VR) and Augmented Reality (AR) applications. Here’s a detailed breakdown of its usage and importance:

  1. The HMD variable is typically used to access the Head-Mounted Display device through the XR (Extended Reality) system in Unreal Engine.

  2. It is utilized across various Unreal Engine subsystems, including rendering, input handling, and XR-specific modules.

  3. The value of this variable is usually set by obtaining the HMD device from the XR system, often through calls like GEngine->XRSystem->GetHMDDevice().

  4. It interacts with other variables and systems related to XR functionality, such as controller input, tracking, and stereoscopic rendering.

  5. Developers should be aware that the HMD variable might be null if no XR system is active or if no HMD is connected, so null checks are important when using it.

  6. Best practices include:

    • Always check if the XR system and HMD are valid before using them.
    • Use the HMD interface to query device-specific information and capabilities.
    • Be mindful of performance implications when frequently accessing HMD data.
  7. The HMD variable is crucial for implementing VR-specific features such as:

    • Stereoscopic rendering
    • Motion tracking
    • VR-specific input handling
    • Managing VR viewing parameters (e.g., Field of View, IPD)
  8. It’s used in various parts of the engine, including the render thread, game thread, and input processing systems.

  9. The HMD variable often provides access to specialized functions for VR, such as setting clipping planes, managing spectator screens, and handling VR-specific rendering techniques.

  10. When developing for multiple XR platforms, it’s important to use the HMD interface methods rather than platform-specific code to ensure compatibility.

In summary, the HMD variable is a central component for VR development in Unreal Engine, providing access to critical VR functionality and device-specific features. Proper usage of this variable is essential for creating immersive and performant VR experiences.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingHMD/Private/PixelStreamingHMDModule.h:31

Scope (from outer to inner):

file
namespace    UE::PixelStreamingHMD
class        class FPixelStreamingHMDModule : public IPixelStreamingHMDModule

Source code excerpt:

		/** IHeadMountedDisplayModule implementation */

		TSharedPtr<FPixelStreamingHMD, ESPMode::ThreadSafe> HMD;
		EPixelStreamingXRSystem ActiveXRSystem;
	};
} // namespace UE::PixelStreamingHMD

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingInput/Private/PixelStreamingInputHandler.cpp:202

Scope (from outer to inner):

file
namespace    UE::PixelStreamingInput
function     bool FPixelStreamingInputHandler::GetControllerOrientationAndPosition

Source code excerpt:

	bool FPixelStreamingInputHandler::GetControllerOrientationAndPosition(const int32 ControllerIndex, const FName MotionSource, FRotator& OutOrientation, FVector& OutPosition, float WorldToMetersScale) const
	{
		if (FPixelStreamingHMD* HMD = IPixelStreamingHMDModule::Get().GetPixelStreamingHMD(); (HMD == nullptr || ControllerIndex == INDEX_NONE))
		{
			return false;
		}

		EControllerHand DeviceHand;
		if (GetHandEnumForSourceName(MotionSource, DeviceHand))

#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingInput/Private/PixelStreamingInputHandler.cpp:934

Scope (from outer to inner):

file
namespace    UE::PixelStreamingInput
function     void FPixelStreamingInputHandler::HandleOnXREyeViews

Source code excerpt:

		FMatrix RightEyeProjectionMatrix = ExtractWebXRMatrix(Ar);

		if (FPixelStreamingHMD* HMD = IPixelStreamingHMDModule::Get().GetPixelStreamingHMD(); HMD != nullptr)
		{
			HMD->SetEyeViews(LeftEyeTransform, LeftEyeProjectionMatrix, RightEyeTransform, RightEyeProjectionMatrix);
		}
	}

	void FPixelStreamingInputHandler::HandleOnXRHMDTransform(FMemoryReader Ar)
	{
		// The `Ar` buffer contains the transform matrix stored as 16 floats
		FTransform HMDTransform = WebXRMatrixToUETransform(ExtractWebXRMatrix(Ar));

		if (FPixelStreamingHMD* HMD = IPixelStreamingHMDModule::Get().GetPixelStreamingHMD(); HMD != nullptr)
		{
			HMD->SetTransform(HMDTransform);
		}
	}

	void FPixelStreamingInputHandler::HandleOnXRControllerTransform(FMemoryReader Ar)
	{
		// The `Ar` buffer contains the transform matrix stored as 16 floats

#Loc: <Workspace>/Engine/Plugins/Runtime/MixedRealityCaptureFramework/Source/MixedRealityCaptureFramework/Private/MixedRealityCaptureActor.cpp:274

Scope (from outer to inner):

file
namespace    CastingModeRestore_Impl
function     ISpectatorScreenController* GetSpectatorScreenController

Source code excerpt:

	ISpectatorScreenController* GetSpectatorScreenController()
	{
		IHeadMountedDisplay* HMD = GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;
		if (HMD)
		{
			return HMD->GetSpectatorScreenController();
		}
		return nullptr;
	}
}

AMixedRealityCaptureActor::FCastingModeRestore::FCastingModeRestore()

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRHMD/Private/FBFoveationImageGenerator.cpp:32

Scope (from outer to inner):

file
function     FFBFoveationImageGenerator::FFBFoveationImageGenerator

Source code excerpt:

	ECVF_RenderThreadSafe);

FFBFoveationImageGenerator::FFBFoveationImageGenerator(bool bIsFoveationExtensionSupported, XrInstance InInstance, FOpenXRHMD* HMD, bool bMobileMultiViewEnabled)
	: bIsMobileMultiViewEnabled(bMobileMultiViewEnabled)
	, CurrentFrameSwapchainIndex(0)
	, bFoveationExtensionSupported(bIsFoveationExtensionSupported)
{
	if (bFoveationExtensionSupported)
	{

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRHMD/Private/FBFoveationImageGenerator.cpp:52

Scope (from outer to inner):

file
function     FFBFoveationImageGenerator::FFBFoveationImageGenerator

Source code excerpt:

	}

	OpenXRHMD = HMD;
}

FRDGTextureRef FFBFoveationImageGenerator::GetImage(FRDGBuilder& GraphBuilder, const FViewInfo& ViewInfo, FVariableRateShadingImageManager::EVRSImageType ImageType, bool bGetSoftwareImage)
{
	if (!bFoveationExtensionSupported || !OpenXRHMD || FoveationImages.IsEmpty() || bGetSoftwareImage)
	{

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRHMD/Private/FBFoveationImageGenerator.h:13

Scope (from outer to inner):

file
class        class FFBFoveationImageGenerator : public IVariableRateShadingImageGenerator

Source code excerpt:

{
public:
	FFBFoveationImageGenerator(bool bIsFoveationExtensionSupported, XrInstance InInstance, FOpenXRHMD* HMD, bool bMobileMultiViewEnabled);
	virtual ~FFBFoveationImageGenerator() override {};

	bool IsFoveationExtensionEnabled() { return bFoveationExtensionSupported;}
	// bReallocatedSwapchain forces foveation images to update even if the foveation params haven't changed.
	void UpdateFoveationImages(bool bReallocatedSwapchain = false);
	void SetCurrentFrameSwapchainIndex(int32 CurrentFrameSwapchainIndex);

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRHMD/Private/OpenXRHMD.cpp:331

Scope (from outer to inner):

file
function     bool FOpenXRHMD::GetCurrentInteractionProfile

Source code excerpt:

{
	int32 DeviceId = -1;
	if (Hand == EControllerHand::HMD)
	{
		DeviceId = IXRTrackingSystem::HMDDeviceId;
	}
	else
	{
		TArray<int32> Devices;

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRInput/Private/OpenXRInput.cpp:235

Scope (from outer to inner):

file
function     void FOpenXRInputPlugin::FOpenXRController::AddTrackedDevices

Source code excerpt:

}

void FOpenXRInputPlugin::FOpenXRController::AddTrackedDevices(IOpenXRHMD* HMD)
{
	if (HMD)
	{
		GripDeviceId = HMD->AddTrackedDevice(GripAction, UserPath);
		AimDeviceId = HMD->AddTrackedDevice(AimAction, UserPath);
		PalmDeviceId = HMD->AddTrackedDevice(PalmAction, UserPath);
	}
}

FOpenXRInputPlugin::FInteractionProfile::FInteractionProfile(XrPath InProfile, bool InHasHaptics)
	: HasHaptics(InHasHaptics)
	, Path(InProfile)

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRInput/Private/OpenXRInput.cpp:374

Scope (from outer to inner):

file
function     bool FOpenXRInputPlugin::FOpenXRInput::BuildActions

Source code excerpt:

	Controllers.Add(EControllerHand::Left, FOpenXRController(ControllerActionSet->Handle, LeftHand, "Left Controller"));
	Controllers.Add(EControllerHand::Right, FOpenXRController(ControllerActionSet->Handle, RightHand, "Right Controller"));
	Controllers.Add(EControllerHand::HMD, FOpenXRController(ControllerActionSet->Handle, Head, "HMD"));

	// Make OpenXRHMD aware of the controller action spaces
	Controllers[EControllerHand::Left].AddTrackedDevices(OpenXRHMD);
	Controllers[EControllerHand::Right].AddTrackedDevices(OpenXRHMD);

	// Generate a map of all supported interaction profiles to store suggested bindings

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRInput/Private/OpenXRInput.cpp:1415

Scope (from outer to inner):

file
function     void FOpenXRInputPlugin::FOpenXRInput::SetHapticFeedbackValues

Source code excerpt:

			Controller = Controllers.Find(EControllerHand::Right);
		}
		if (Hand == (int32)EControllerHand::HMD)
		{
			Controller = Controllers.Find(EControllerHand::HMD);
		}

		if (Controller)
		{
			XrHapticActionInfo HapticActionInfo;
			HapticActionInfo.type = XR_TYPE_HAPTIC_ACTION_INFO;

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXR/Source/OpenXRInput/Private/OpenXRInput.h:93

Scope (from outer to inner):

file
class        class FOpenXRInputPlugin : public IOpenXRInputPlugin

Source code excerpt:

		FOpenXRController(XrActionSet InActionSet, XrPath InUserPath, const char* InName);

		void AddTrackedDevices(IOpenXRHMD* HMD);
	};

	struct FInteractionProfile
	{
	public:
		bool HasHaptics;

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXRViveTracker/Source/OpenXRViveTracker/Private/OpenXRViveTracker.cpp:113

Scope (from outer to inner):

file
function     void FOpenXRViveTracker::FViveTracker::AddTrackedDevices

Source code excerpt:

}

void FOpenXRViveTracker::FViveTracker::AddTrackedDevices(IOpenXRHMD* HMD)
{
	if (HMD)
	{
		DeviceId = HMD->AddTrackedDevice(GripAction, RolePath);
	}
}

void FOpenXRViveTracker::FViveTracker::GetSuggestedBindings(TArray<XrActionSuggestedBinding>& OutSuggestedBindings)
{
	OutSuggestedBindings.Add(XrActionSuggestedBinding{ GripAction, RolePath / FString("input/grip/pose") });

#Loc: <Workspace>/Engine/Plugins/Runtime/OpenXRViveTracker/Source/OpenXRViveTracker/Private/OpenXRViveTracker.h:33

Scope (from outer to inner):

file
class        class FOpenXRViveTracker : public IOpenXRExtensionPlugin, public IInputDevice, public FXRMotionControllerBase, public IHapticDevice

Source code excerpt:

		FViveTracker(XrActionSet InActionSet, FOpenXRPath InRolePath, const char* InName);

		void AddTrackedDevices(class IOpenXRHMD* HMD);
		void GetSuggestedBindings(TArray<XrActionSuggestedBinding>& OutSuggestedBindings);
	};

public:
	FOpenXRViveTracker(const TSharedRef<FGenericApplicationMessageHandler>& InMessageHandler);
	virtual ~FOpenXRViveTracker();

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/DefaultXRCamera.cpp:148

Scope (from outer to inner):

file
function     void FDefaultXRCamera::BeginRenderViewFamily

Source code excerpt:

		// Backwards compatibility during deprecation phase. Remove once IHeadMountedDisplay::BeginRendering_GameThread has been removed.
		PRAGMA_DISABLE_DEPRECATION_WARNINGS
		auto HMD = TrackingSystem->GetHMDDevice();
		if (HMD)
		{
			HMD->BeginRendering_GameThread();
		}
		PRAGMA_ENABLE_DEPRECATION_WARNINGS
	}
	TrackingSystem->OnBeginRendering_GameThread();
}

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/DefaultXRCamera.cpp:197

Scope (from outer to inner):

file
function     void FDefaultXRCamera::PreRenderViewFamily_RenderThread

Source code excerpt:

				// Backwards compatibility during deprecation phase. Remove once IHeadMountedDisplay::BeginRendering_RenderThread has been removed.
				PRAGMA_DISABLE_DEPRECATION_WARNINGS
					auto HMD = TrackingSystem->GetHMDDevice();
				if (HMD)
				{
					HMD->BeginRendering_RenderThread(CurrentRelativeTransform, GraphBuilder.RHICmdList, ViewFamily);
				}
				PRAGMA_ENABLE_DEPRECATION_WARNINGS
			}
		}
	}
}

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/DefaultXRCamera.cpp:212

Scope (from outer to inner):

file
function     void FDefaultXRCamera::SetupViewFamily

Source code excerpt:

	static const auto CVarAllowMotionBlurInVR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("vr.AllowMotionBlurInVR"));
	const bool AllowMotionBlur = (CVarAllowMotionBlurInVR && CVarAllowMotionBlurInVR->GetValueOnAnyThread() != 0);
	const IHeadMountedDisplay* const HMD = TrackingSystem->GetHMDDevice();
	InViewFamily.EngineShowFlags.MotionBlur = AllowMotionBlur;
	if (InViewFamily.Views.Num() > 0 && !InViewFamily.Views[0]->bIsSceneCapture)
	{
		InViewFamily.EngineShowFlags.HMDDistortion = HMD != nullptr ? HMD->GetHMDDistortionEnabled(InViewFamily.Scene->GetShadingPath()) : false;
	}
	InViewFamily.EngineShowFlags.StereoRendering = bCurrentFrameIsStereoRendering;
	InViewFamily.EngineShowFlags.Rendering = HMD != nullptr ? !HMD->IsRenderingPaused() : true;
}

void FDefaultXRCamera::SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView)
{
	FQuat DeviceOrientation;
	FVector DevicePosition;

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayConsoleCommands.cpp:327

Scope (from outer to inner):

file
function     static void HMDStatus

Source code excerpt:

	if (GEngine && GEngine->XRSystem.IsValid())
	{
		auto HMD = GEngine->XRSystem;
		Ar.Logf(TEXT("Position tracking status: %s\nHead tracking allowed: %s\nNumber of tracking sensors: %d"), 
			HMD->DoesSupportPositionalTracking() ? (HMD->HasValidTrackingPosition() ? TEXT("active") : TEXT("lost")) : TEXT("not supported"),
			HMD->IsHeadTrackingAllowed() ? (HMD->IsHeadTrackingEnforced() ? TEXT("enforced") : TEXT("yes")) : TEXT("no"),
			HMD->CountTrackedDevices(EXRTrackedDeviceType::TrackingReference));
	}
}

static FAutoConsoleCommand CHMDStatusCmd(
	TEXT("vr.HeadTracking.Status"),
	*LOCTEXT("CVarText_HMDStatus", "Reports the current status of the head tracking.").ToString(),

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayConsoleCommands.cpp:369

Scope (from outer to inner):

file
function     static void EnableHMD

Source code excerpt:

{
	bool bEnable = 0;
	IHeadMountedDisplay* HMD = GEngine && GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;
	if (!HMD)
	{
		return;
	}
	
	if (Args.Num())
	{
		bEnable = FCString::ToBool(*Args[0]);
		HMD->EnableHMD(bEnable);

		/* TODO: calling EnableStereo after calling EnableHMD replicates the function library behavior:
		if (GEngine->StereoRenderingDevice.IsValid())
		{
			GEngine->StereoRenderingDevice->EnableStereo(bEnable);
		}

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayConsoleCommands.cpp:389

Scope (from outer to inner):

file
function     static void EnableHMD

Source code excerpt:

	else
	{
		bEnable = HMD->IsHMDEnabled();
		Ar.Logf(TEXT("HMD device is %s"), bEnable?TEXT("enabled"):TEXT("disabled"));
	}
}

static FAutoConsoleCommand CEnableHMDCmd(
	TEXT("vr.bEnableHMD"),

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayConsoleCommands.cpp:402

Scope (from outer to inner):

file
function     static void EnableStereo

Source code excerpt:

{
	bool bEnable = 0;
	IHeadMountedDisplay* HMD = GEngine && GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;

	if (Args.Num())
	{
		bEnable = FCString::ToBool(*Args[0]);

		if (GEngine && GEngine->StereoRenderingDevice.IsValid())
		{
			if (HMD && !HMD->IsHMDEnabled())
			{
				Ar.Logf(TEXT("HMD is disabled. Use 'vr.bEnableHMD True' to re-enable it."));
			}
			GEngine->StereoRenderingDevice->EnableStereo(bEnable);
		}
	}

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayConsoleCommands.cpp:505

Scope (from outer to inner):

file
function     static bool CompatExec

Source code excerpt:

		}
	}
	else if (FParse::Command(&Cmd, TEXT("HMD")))
	{
		if (FParse::Command(&Cmd, TEXT("ON")) || FParse::Command(&Cmd, TEXT("ENABLE")))
		{
			AliasedCommand = TEXT("vr.bEnableHMD True");
		}
		if (FParse::Command(&Cmd, TEXT("OFF")) || FParse::Command(&Cmd, TEXT("DISABLE")))

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayFunctionLibrary.cpp:84

Scope (from outer to inner):

file
function     int32 UHeadMountedDisplayFunctionLibrary::GetXRSystemFlags

Source code excerpt:

	{
		SystemFlags = GEngine->XRSystem->GetXRSystemFlags();
		auto HMD = GEngine->XRSystem->GetHMDDevice();
		if (HMD && !HMD->IsHMDConnected())
		{
			// Clear the flags if a HMD device is present but not connected
			// Note that the HMD device is usually the XR system itself
			// and the latter is registered as soon as the corresponding plugin is loaded
			SystemFlags = 0;
		}

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayFunctionLibrary.cpp:201

Scope (from outer to inner):

file
function     void UHeadMountedDisplayFunctionLibrary::SetClippingPlanes

Source code excerpt:

void UHeadMountedDisplayFunctionLibrary::SetClippingPlanes(float Near, float Far)
{
	IHeadMountedDisplay* HMD = GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;

	if (HMD)
	{
		HMD->SetClippingPlanes(Near, Far);
	}
}

float UHeadMountedDisplayFunctionLibrary::GetPixelDensity()
{
	static const auto PixelDensityTCVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("vr.pixeldensity"));

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayFunctionLibrary.cpp:278

Scope (from outer to inner):

file
function     void UHeadMountedDisplayFunctionLibrary::GetVRFocusState

Source code excerpt:

void UHeadMountedDisplayFunctionLibrary::GetVRFocusState(bool& bUseFocus, bool& bHasFocus)
{
	IHeadMountedDisplay* HMD = GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;
	if (HMD)
	{
		bUseFocus = HMD->DoesAppUseVRFocus();
		bHasFocus = HMD->DoesAppHaveVRFocus();
	}
	else
	{
		bUseFocus = bHasFocus = false;
	}
}

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayFunctionLibrary.cpp:294

Scope (from outer to inner):

file
namespace    HMDFunctionLibraryHelpers
function     ISpectatorScreenController* GetSpectatorScreenController

Source code excerpt:

	ISpectatorScreenController* GetSpectatorScreenController()
	{
		IHeadMountedDisplay* HMD = GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;
		if (HMD)
		{
			return HMD->GetSpectatorScreenController();
		}
		return nullptr;
	}
}

bool UHeadMountedDisplayFunctionLibrary::IsSpectatorScreenModeControllable()

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Private/HeadMountedDisplayFunctionLibrary.cpp:644

Scope (from outer to inner):

file
function     bool UHeadMountedDisplayFunctionLibrary::SetHMDColorScaleAndBias

Source code excerpt:

	IXRTrackingSystem* TrackingSys = GEngine->XRSystem.Get();
	if (TrackingSys) {
		IHeadMountedDisplay* HMD = TrackingSys->GetHMDDevice();
		if (HMD) {
			return HMD->SetColorScaleAndBias(ColorScale, ColorBias);
		}
	}
	return false;
}

#Loc: <Workspace>/Engine/Source/Developer/TargetPlatform/Public/Interfaces/ITargetDevice.h:56

Scope: file

Source code excerpt:


	/** The device is a standalone HMD */
	HMD
};

/**
 * Enumerates how the target device is connected
 */
enum class ETargetDeviceConnectionTypes

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/VREditorModeManager.cpp:68

Scope (from outer to inner):

file
function     void FVREditorModeManager::Tick

Source code excerpt:

{
	// You can only auto-enter VR if the setting is enabled. Other criteria are that the VR Editor is enabled in experimental settings, that you are not in PIE, and that the editor is foreground.
	IHeadMountedDisplay * const HMD = GEngine != nullptr && GEngine->XRSystem.IsValid() ? GEngine->XRSystem->GetHMDDevice() : nullptr;
	if (GetDefault<UVRModeSettings>()->bEnableAutoVREditMode
		&& HMD
		&& FPlatformApplicationMisc::IsThisApplicationForeground())
	{
		const EHMDWornState::Type LatestHMDWornState = HMD->GetHMDWornState();
		if (HMDWornState != LatestHMDWornState)
		{
			HMDWornState = LatestHMDWornState;
			if (HMDWornState == EHMDWornState::Worn && CurrentVREditorMode == nullptr)
			{
				EnableVREditor( true, false );

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:4456

Scope (from outer to inner):

file
function     void APlayerController::PlayHapticEffect

Source code excerpt:

			ActiveHapticEffect_Gun = MakeShareable(new FActiveHapticFeedbackEffect(HapticEffect, Scale, bLoop));
			break;
		case EControllerHand::HMD:
			ActiveHapticEffect_HMD.Reset();
			ActiveHapticEffect_HMD = MakeShareable(new FActiveHapticFeedbackEffect(HapticEffect, Scale, bLoop));
			break;
		default:
			UE_LOG(LogPlayerController, Warning, TEXT("Invalid hand specified (%d) for haptic feedback effect %s"), (int32)Hand, *HapticEffect->GetName());
			break;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:4506

Scope (from outer to inner):

file
function     void APlayerController::SetHapticsByValue

Source code excerpt:

		ActiveHapticEffect_Gun.Reset();
	}
	else if (Hand == EControllerHand::HMD)
	{
		ActiveHapticEffect_HMD.Reset();
	}
	else
	{
		UE_LOG(LogPlayerController, Warning, TEXT("Invalid hand specified (%d) for setting haptic feedback values (F: %f A: %f)"), (int32)Hand, Frequency, Amplitude);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:4732

Scope (from outer to inner):

file
function     void APlayerController::ProcessForceFeedbackAndHaptics

Source code excerpt:

					if (bHMDHapticsNeedUpdate)
					{
						InputInterface->SetHapticFeedbackValues(ControllerId, (int32)EControllerHand::HMD, HMDHaptics);
					}
				}
			}
		}
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Slate/DebugCanvas.cpp:272

Scope (from outer to inner):

file
function     void FDebugCanvasDrawer::Draw_RenderThread

Source code excerpt:

				if (StereoLayers->ShouldCopyDebugLayersToSpectatorScreen() && LayerID != INVALID_LAYER_ID && GEngine && GEngine->XRSystem)
				{
					IHeadMountedDisplay* HMD = GEngine->XRSystem->GetHMDDevice();
					if (HMD)
					{
						ISpectatorScreenController* SpectatorScreenController = HMD->GetSpectatorScreenController();
						if (SpectatorScreenController)
						{
							SpectatorScreenController->QueueDebugCanvasLayerID(LayerID);
						}
					}
				}

#Loc: <Workspace>/Engine/Source/Runtime/HeadMountedDisplay/Private/IMotionController.cpp:22

Scope (from outer to inner):

file
function     bool IMotionController::GetHandEnumForSourceName

Source code excerpt:

		MotionSourceToEControllerHandMap.Add(TEXT("ExternalCamera"), EControllerHand::ExternalCamera);
		MotionSourceToEControllerHandMap.Add(TEXT("Gun"), EControllerHand::Gun);
		MotionSourceToEControllerHandMap.Add(TEXT("HMD"), EControllerHand::HMD);
		MotionSourceToEControllerHandMap.Add(TEXT("Chest"), EControllerHand::Chest);
		MotionSourceToEControllerHandMap.Add(TEXT("LeftShoulder"), EControllerHand::LeftShoulder);
		MotionSourceToEControllerHandMap.Add(TEXT("RightShoulder"), EControllerHand::RightShoulder);
		MotionSourceToEControllerHandMap.Add(TEXT("LeftElbow"), EControllerHand::LeftElbow);
		MotionSourceToEControllerHandMap.Add(TEXT("RightElbow"), EControllerHand::RightElbow);
		MotionSourceToEControllerHandMap.Add(TEXT("Waist"), EControllerHand::Waist);

#Loc: <Workspace>/Engine/Source/Runtime/HeadMountedDisplay/Private/IMotionController.cpp:41

Scope (from outer to inner):

file
function     bool IMotionController::GetHandEnumForSourceName

Source code excerpt:

		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::ExternalCamera"), EControllerHand::ExternalCamera);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::Gun"), EControllerHand::Gun);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::HMD"), EControllerHand::HMD);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::Chest"), EControllerHand::Chest);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::LeftShoulder"), EControllerHand::LeftShoulder);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::RightShoulder"), EControllerHand::RightShoulder);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::LeftElbow"), EControllerHand::LeftElbow);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::RightElbow"), EControllerHand::RightElbow);
		MotionSourceToEControllerHandMap.Add(TEXT("EControllerHand::Waist"), EControllerHand::Waist);

#Loc: <Workspace>/Engine/Source/Runtime/HeadMountedDisplay/Private/IMotionController.cpp:58

Scope (from outer to inner):

file
function     bool IMotionController::GetHandEnumForSourceName

Source code excerpt:

		MotionSourceToEControllerHandMap.Add(TEXT("LeftAim"), EControllerHand::Left);
		MotionSourceToEControllerHandMap.Add(TEXT("RightAim"), EControllerHand::Right);
		MotionSourceToEControllerHandMap.Add(IMotionController::HeadSourceId, EControllerHand::HMD);
	}

	EControllerHand* FoundEnum = MotionSourceToEControllerHandMap.Find(Source);
	if (FoundEnum != nullptr)
	{
		OutHand = *FoundEnum;

#Loc: <Workspace>/Engine/Source/Runtime/InputCore/Classes/InputCoreTypes.h:21

Scope: file

Source code excerpt:

	ExternalCamera,
	Gun,
	HMD,
	Chest,
	LeftShoulder,
	RightShoulder,
	LeftElbow,
	RightElbow,
	Waist,

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanExtensions.cpp:1426

Scope (from outer to inner):

file
function     FVulkanDeviceExtensionArray FVulkanDeviceExtension::GetUESupportedDeviceExtensions

Source code excerpt:

			TArray<const ANSICHAR*> HMDExtensions;
			FVulkanDynamicRHI::HMDVulkanExtensions->GetVulkanDeviceExtensionsRequired(InDevice->GetPhysicalHandle(), HMDExtensions);
			ActivateExternalExtensions(HMDExtensions, TEXT("HMD"));
		}
	}

	// Add extensions added outside the RHI (eg plugins)
	ActivateExternalExtensions(ExternalExtensions, TEXT("Externally"));

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanExtensions.cpp:1566

Scope (from outer to inner):

file
function     FVulkanInstanceExtensionArray FVulkanInstanceExtension::GetUESupportedInstanceExtensions

Source code excerpt:

			TArray<const ANSICHAR*> HMDExtensions;
			FVulkanDynamicRHI::HMDVulkanExtensions->GetVulkanInstanceExtensionsRequired(HMDExtensions);
			ActivateExternalExtensions(HMDExtensions, TEXT("HMD"));
		}
	}

	// Add extensions added outside the RHI (eg plugins)
	ActivateExternalExtensions(ExternalExtensions, TEXT("Externally"));