OculusHMD

OculusHMD

#Overview

name: OculusHMD

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of OculusHMD is to represent the Oculus Head-Mounted Display (HMD) system within Unreal Engine 5. It serves as an identifier for the Oculus VR ecosystem and is used in various parts of the engine to handle Oculus-specific functionality.

This setting variable is primarily used in the XR (Extended Reality) subsystem of Unreal Engine 5. It is referenced in the XRBase plugin and the VREditor module, indicating its importance in both runtime XR experiences and VR-based editor functionality.

The value of this variable is typically set internally by the engine when it detects and initializes an Oculus HMD. It’s not something that developers usually need to set manually.

OculusHMD interacts with other XR-related variables and systems, particularly those dealing with device tracking, input handling, and UI positioning in VR environments.

Developers should be aware that:

  1. This variable is used to identify Oculus-specific hardware and may influence how certain XR functions behave.
  2. It’s used in device enumeration and tracking, which is crucial for proper VR functionality.
  3. The VR editor UI system uses this variable to adjust UI positioning and input handling specifically for Oculus devices.

Best practices when using this variable include:

  1. Use it for conditional logic when you need to implement Oculus-specific features or optimizations.
  2. Avoid hardcoding references to OculusHMD; instead, use the engine’s XR system APIs to query device types when possible.
  3. Be aware that code paths using this variable might not be executed on non-Oculus VR systems, so ensure your application remains functional across different VR platforms.
  4. When developing cross-platform VR applications, use this variable in conjunction with other platform identifiers to create a consistent experience across different VR systems.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3221, section: [HMDPluginPriority]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/XRBase/Source/XRBase/Public/HeadMountedDisplayFunctionLibrary.h:258

Scope (from outer to inner):

file
function     class XRBASE_API UHeadMountedDisplayFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_UCLASS_BODY

Source code excerpt:

	 * Cross XR-System query that will list all XR devices currently being tracked.
	 *
	 * @param  SystemId		(Optional) Specifies an explicit system to poll devices from (use if you want only devices belonging to one explicit XR ecosystem, e.g. 'OculusHMD', or 'OpenXR')
	 * @param  DeviceType	Specifies the type of device to query for - defaults to 'Any' (meaning 'All').
	 *
	 * @return A list of device identifiers matching the query. Use these to query and operate on the device (e.g. through GetDevicePose, AddDeviceVisualizationComponent, etc.)
	 */
	UFUNCTION(BlueprintCallable, Category="Input|XRTracking")
	static TArray<FXRDeviceId> EnumerateTrackedDevices(const FName SystemId = NAME_None, EXRTrackedDeviceType DeviceType = EXRTrackedDeviceType::Any);

	/**
	 * Cross XR-System query that returns a specific device's tracked position and orientation (in tracking space).
	 *
	 * @param  XRDeviceId				Specifies the device you're querying for.
	 * @param  bIsTracked				[out] Details if the specified device is tracked (i.e. should the rest of the outputs be used)
	 * @param  Orientation				[out] Represents the device's current rotation - NOTE: this value is not late updated and will be behind the render thread

#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayCluster/Private/Game/EngineClasses/Basics/DisplayClusterViewportClient.cpp:973

Scope (from outer to inner):

file
function     void UDisplayClusterViewportClient::Draw

Source code excerpt:

		{
#if 0 //!UE_BUILD_SHIPPING
			// TODO: replace implementation in OculusHMD with a debug renderer
			if (GEngine->XRSystem.IsValid())
			{
				GEngine->XRSystem->DrawDebug(DebugCanvasObject);
			}
#endif
		}

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorUISystem.cpp:280

Scope (from outer to inner):

file
function     void UVREditorUISystem::OnPreviewInputAction

Source code excerpt:

{
	static const FName SteamVR(TEXT("SteamVR"));
	static const FName OculusHMD(TEXT("OculusHMD"));

	UVREditorInteractor* VREditorInteractor = Cast<UVREditorInteractor>(Interactor);
	
	// If we are releasing a UI panel that started drag from opening it.
	if (VREditorInteractor && UIInteractor != nullptr && DraggingUI != nullptr && InteractorDraggingUI != nullptr && UIInteractor == InteractorDraggingUI && VREditorInteractor == UIInteractor && 
		 Action.Event == EInputEvent::IE_Released && 

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorUISystem.cpp:305

Scope (from outer to inner):

file
function     void UVREditorUISystem::OnPreviewInputAction

Source code excerpt:

	{
		if (Action.Event == EInputEvent::IE_Pressed && 
			VRMode->GetHMDDeviceType() == OculusHMD 
			&& Action.ActionType == VRActionTypes::ConfirmRadialSelection
			&& GIsDemoMode)
		{
			ResetAll();
			bWasHandled = true;
		}

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorUISystem.cpp:354

Scope (from outer to inner):

file
function     void UVREditorUISystem::OnPreviewInputAction

Source code excerpt:

				if (!bWasHandled)
				{
					if ((VRMode->GetHMDDeviceType() == OculusHMD && Action.ActionType == ViewportWorldActionTypes::SelectAndMove) || 
						(VRMode->GetHMDDeviceType() == SteamVR && Action.ActionType == VRActionTypes::ConfirmRadialSelection))
					{
						// If the radial menu is showing, select the currently highlighted button by pressing the trigger
						if (QuickRadialMenu->GetCurrentlyHoveredButton().IsValid())
						{
							if ((Action.Event == IE_Pressed))

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorUISystem.cpp:871

Scope (from outer to inner):

file
function     void UVREditorUISystem::CreateUIs

Source code excerpt:

{
	static const FName SteamVR(TEXT("SteamVR"));
	static const FName OculusHMD(TEXT("OculusHMD"));

	const FIntPoint DefaultResolution( VREd::DefaultEditorUIResolutionX->GetInt(), VREd::DefaultEditorUIResolutionY->GetInt() );
	const bool bShowUI = UVREditorMode::IsDebugModeEnabled();

	{
		const bool bWithSceneComponent = false;

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorUISystem.cpp:899

Scope (from outer to inner):

file
function     void UVREditorUISystem::CreateUIs

Source code excerpt:

				RelativeOffset = FVector(-5.0f, 0.0f, 5.0f);
			}
			else if (VRMode->GetHMDDeviceType() == OculusHMD)
			{
				RelativeOffset = FVector(0.0f, 0.0f, 3.0f);
			}

			QuickRadialMenu->SetRelativeOffset(RelativeOffset);
			QuickRadialMenu->ShowUI(bShowUI, false, 0.0f, false);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameViewportClient.cpp:2009

Scope (from outer to inner):

file
function     void UGameViewportClient::Draw

Source code excerpt:

		{
#if 0 //!UE_BUILD_SHIPPING
			// TODO: replace implementation in OculusHMD with a debug renderer
			if (GEngine->XRSystem.IsValid())
			{
				GEngine->XRSystem->DrawDebug(DebugCanvasObject);
			}
#endif
		}