p.DisableEditorPhysicsHandle

p.DisableEditorPhysicsHandle

#Overview

name: p.DisableEditorPhysicsHandle

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.DisableEditorPhysicsHandle is to control the behavior of physics manipulation in the Unreal Engine editor, specifically during Play-in-Editor (PIE) mode. It is used to disable the physics spring mechanism for dragging objects and instead use teleportation for object manipulation.

This setting variable is primarily used by the Unreal Engine’s physics and editor subsystems. Based on the callsites, it is referenced in the UnrealEd module (PhysicsManipulationMode.cpp) and the Chaos experimental physics module (PBDRigidsEvolutionGBF.cpp).

The value of this variable is set through a console variable (cvar) using the FAutoConsoleVariableRef mechanism. It is initialized as false by default but can be changed at runtime through the console or configuration files.

The associated variable bDisableEditorPhysicsHandle directly interacts with p.DisableEditorPhysicsHandle. They share the same value, with bDisableEditorPhysicsHandle being the C++ representation of the console variable.

Developers must be aware that enabling this variable will change the behavior of object manipulation in the editor, particularly during PIE. Instead of using a physics spring for smooth movement, objects will teleport to their new positions. This can be useful for certain debugging scenarios but may not provide a realistic simulation of physics interactions.

Best practices for using this variable include:

  1. Use it primarily for debugging purposes, especially when investigating physics-related issues.
  2. Be cautious when enabling it in production environments, as it may affect the perceived quality of physics interactions.
  3. Consider using it in conjunction with other physics debugging tools and cvars for a comprehensive debugging approach.

Regarding the associated variable bDisableEditorPhysicsHandle:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PhysicsManipulationMode.cpp:12

Scope: file

Source code excerpt:

// Disable drag handles for PIE manipulation and just teleport (handy for some internal physics debugging modes)
bool bDisableEditorPhysicsHandle = false;
FAutoConsoleVariableRef CVarHackMaxVelocity(TEXT("p.DisableEditorPhysicsHandle"), bDisableEditorPhysicsHandle, TEXT("When true, disable the physics spring for dragging objects in PIE. Use a teleport instead."));


void FPhysicsManipulationEdModeFactory::OnSelectionChanged(FEditorModeTools& Tools, UObject* ItemUndergoingChange) const
{
	USelection* Selection = GEditor->GetSelectedActors();

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:173

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		// This is used to test collision detection and - it will be removed
		// NOTE: You should also set the following for dragging in PIE to work while test mode is active:
		// 		p.DisableEditorPhysicsHandle 1
		bool bChaos_Solver_TestMode_Enabled  = false;
		FAutoConsoleVariableRef CVarChaosSolverTestModeEnabled(TEXT("p.Chaos.Solver.TestMode.Enabled"), bChaos_Solver_TestMode_Enabled, TEXT(""));

		bool bChaos_Solver_TestMode_ShowInitialTransforms = false;
		FAutoConsoleVariableRef CVarChaosSolverTestModeShowInitialTransforms(TEXT("p.Chaos.Solver.TestMode.ShowInitialTransforms"), bChaos_Solver_TestMode_ShowInitialTransforms, TEXT(""));
		

#Associated Variable and Callsites

This variable is associated with another variable named bDisableEditorPhysicsHandle. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PhysicsManipulationMode.cpp:11

Scope: file

Source code excerpt:


// Disable drag handles for PIE manipulation and just teleport (handy for some internal physics debugging modes)
bool bDisableEditorPhysicsHandle = false;
FAutoConsoleVariableRef CVarHackMaxVelocity(TEXT("p.DisableEditorPhysicsHandle"), bDisableEditorPhysicsHandle, TEXT("When true, disable the physics spring for dragging objects in PIE. Use a teleport instead."));


void FPhysicsManipulationEdModeFactory::OnSelectionChanged(FEditorModeTools& Tools, UObject* ItemUndergoingChange) const
{
	USelection* Selection = GEditor->GetSelectedActors();

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PhysicsManipulationMode.cpp:87

Scope (from outer to inner):

file
function     bool FPhysicsManipulationEdMode::InputDelta

Source code excerpt:


		// We cannot use a spring to move the object when the world is paused. Teleport instead
		const bool bTeleportObject = (GetWorld() && GetWorld()->IsPaused()) || bDisableEditorPhysicsHandle;
		if (bTeleportObject)
		{
			HandleComp->GrabbedComponent->SetWorldLocationAndRotation(HandleTargetLocation, HandleTargetRotation, false, nullptr, ETeleportType::TeleportPhysics);
			HandleComp->GrabbedComponent->SetPhysicsLinearVelocity(FVector::Zero());
			HandleComp->GrabbedComponent->SetPhysicsAngularVelocityInRadians(FVector::Zero());
		}