vr.EnableMotionControllerLateUpdate
vr.EnableMotionControllerLateUpdate
#Overview
name: vr.EnableMotionControllerLateUpdate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This command allows you to specify whether the motion controller late update is applied.\n 0: don\'t use late update\n 1: use late update (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of vr.EnableMotionControllerLateUpdate is to control whether the motion controller late update is applied in the virtual reality (VR) rendering pipeline. This setting is crucial for reducing latency and improving the responsiveness of motion controllers in VR applications.
This setting variable is primarily used by the HeadMountedDisplay module, which is responsible for managing VR-related functionality in Unreal Engine 5. Specifically, it’s used within the MotionControllerComponent, which handles the behavior and rendering of motion controllers in VR.
The value of this variable is set through a console variable (CVar) named CVarEnableMotionControllerLateUpdate. It’s initialized with a default value of 1, meaning the late update is enabled by default. Users can change this value at runtime using console commands.
The associated variable CVarEnableMotionControllerLateUpdate directly interacts with vr.EnableMotionControllerLateUpdate. They share the same value and purpose.
Developers must be aware that:
- This variable affects the perceived responsiveness of motion controllers in VR.
- Disabling the late update may reduce CPU overhead but could increase perceived latency.
- The setting can be changed at runtime, allowing for performance tuning during development or even in shipped games.
Best practices when using this variable include:
- Generally, keep it enabled (value 1) for the best VR experience.
- Consider disabling it (value 0) only if you’re experiencing performance issues and have ruled out other optimizations.
- Test thoroughly with both settings to ensure your VR application performs well in all scenarios.
Regarding the associated variable CVarEnableMotionControllerLateUpdate:
- It’s an instance of TAutoConsoleVariable
, which allows easy access and modification of the setting through console commands. - It’s used in the UMotionControllerComponent::FViewExtension::IsActiveThisFrame_Internal function to determine if the late update should be applied.
- When working with motion controllers, always check this variable’s value before applying late updates to ensure consistency with the user’s settings.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/HeadMountedDisplay/Private/MotionControllerComponent.cpp:23
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
/** Console variable for specifying whether motion controller late update is used */
TAutoConsoleVariable<int32> CVarEnableMotionControllerLateUpdate(
TEXT("vr.EnableMotionControllerLateUpdate"),
1,
TEXT("This command allows you to specify whether the motion controller late update is applied.\n")
TEXT(" 0: don't use late update\n")
TEXT(" 1: use late update (default)"),
ECVF_Cheat);
} // anonymous namespace
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableMotionControllerLateUpdate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/HeadMountedDisplay/Private/MotionControllerComponent.cpp:22
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
/** Console variable for specifying whether motion controller late update is used */
TAutoConsoleVariable<int32> CVarEnableMotionControllerLateUpdate(
TEXT("vr.EnableMotionControllerLateUpdate"),
1,
TEXT("This command allows you to specify whether the motion controller late update is applied.\n")
TEXT(" 0: don't use late update\n")
TEXT(" 1: use late update (default)"),
ECVF_Cheat);
#Loc: <Workspace>/Engine/Source/Runtime/HeadMountedDisplay/Private/MotionControllerComponent.cpp:475
Scope (from outer to inner):
file
function bool UMotionControllerComponent::FViewExtension::IsActiveThisFrame_Internal
Source code excerpt:
{
check(IsInGameThread());
return MotionControllerComponent && !MotionControllerComponent->bDisableLowLatencyUpdate && CVarEnableMotionControllerLateUpdate.GetValueOnGameThread();
}
//=============================================================================
float UMotionControllerComponent::GetParameterValue(FName InName, bool& bValueFound)
{
if (InUseMotionController)