p.RigidBodyNode.EnableComponentAcceleration

p.RigidBodyNode.EnableComponentAcceleration

#Overview

name: p.RigidBodyNode.EnableComponentAcceleration

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.RigidBodyNode.EnableComponentAcceleration is to control the simple acceleration transfer system for component- or bone-space simulation in the Unreal Engine’s animation system, specifically for rigid body nodes.

This setting variable is primarily used in the AnimGraphRuntime module, which is part of Unreal Engine’s animation system. It directly affects the behavior of the FAnimNode_RigidBody class, which handles rigid body physics simulation within skeletal animations.

The value of this variable is set through an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands. It’s initialized to true by default.

The associated variable bRBAN_EnableComponentAcceleration interacts directly with this setting. They share the same value and purpose.

Developers must be aware that:

  1. This setting affects performance and simulation accuracy. Enabling it allows for more realistic motion transfer between components or bones, but may increase computational cost.
  2. It only has an effect when the simulation space is not set to WorldSpace.
  3. It works in conjunction with other settings like ComponentLinearVelScale and ComponentLinearAccScale.

Best practices when using this variable include:

  1. Consider disabling it if performance is a concern and the additional accuracy is not necessary for your specific use case.
  2. Test your animations with both enabled and disabled states to ensure desired behavior.
  3. Use in combination with other rigid body node settings for fine-tuned control over the physics simulation.

Regarding the associated variable bRBAN_EnableComponentAcceleration:

The purpose of bRBAN_EnableComponentAcceleration is identical to p.RigidBodyNode.EnableComponentAcceleration. It’s the actual boolean variable that controls the functionality within the code.

This variable is used directly in the FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread function to determine whether to apply the acceleration transfer system.

The value of this variable is set through the console variable system, allowing for runtime modification.

It interacts closely with other simulation parameters like ComponentLinearVelScale and ComponentLinearAccScale.

Developers should be aware that this variable directly affects the behavior of the rigid body simulation in non-world space contexts.

Best practices include using this variable in conjunction with profiling tools to balance between simulation accuracy and performance, and considering its impact when debugging animation behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:60

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarRigidBodyNodeMaxSteps(TEXT("p.RigidBodyNode.MaxSubSteps"), RBAN_MaxSubSteps, TEXT("Set the maximum number of simulation steps in the update loop"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableTimeBasedReset(TEXT("p.RigidBodyNode.EnableTimeBasedReset"), bRBAN_EnableTimeBasedReset, TEXT("If true, Rigid Body nodes are reset when they have not been updated for a while (default true)"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableComponentAcceleration(TEXT("p.RigidBodyNode.EnableComponentAcceleration"), bRBAN_EnableComponentAcceleration, TEXT("Enable/Disable the simple acceleration transfer system for component- or bone-space simulation"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeWorldObjectExpiry(TEXT("p.RigidBodyNode.WorldObjectExpiry"), RBAN_WorldObjectExpiry, TEXT("World objects are removed from the simulation if not detected after this many tests"), ECVF_Default);

bool bRBAN_IncludeClothColliders = true;
FAutoConsoleVariableRef CVarRigidBodyNodeIncludeClothColliders(TEXT("p.RigidBodyNode.IncludeClothColliders"), bRBAN_IncludeClothColliders, TEXT("Include cloth colliders as kinematic bodies in the immediate physics simulation."), ECVF_Default);

// FSimSpaceSettings forced overrides for testing

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:56

Scope: file

Source code excerpt:

int32 RBAN_MaxSubSteps = 4;
bool bRBAN_EnableTimeBasedReset = true;
bool bRBAN_EnableComponentAcceleration = true;
int32 RBAN_WorldObjectExpiry = 4;
FAutoConsoleVariableRef CVarRigidBodyNodeMaxSteps(TEXT("p.RigidBodyNode.MaxSubSteps"), RBAN_MaxSubSteps, TEXT("Set the maximum number of simulation steps in the update loop"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableTimeBasedReset(TEXT("p.RigidBodyNode.EnableTimeBasedReset"), bRBAN_EnableTimeBasedReset, TEXT("If true, Rigid Body nodes are reset when they have not been updated for a while (default true)"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableComponentAcceleration(TEXT("p.RigidBodyNode.EnableComponentAcceleration"), bRBAN_EnableComponentAcceleration, TEXT("Enable/Disable the simple acceleration transfer system for component- or bone-space simulation"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeWorldObjectExpiry(TEXT("p.RigidBodyNode.WorldObjectExpiry"), RBAN_WorldObjectExpiry, TEXT("World objects are removed from the simulation if not detected after this many tests"), ECVF_Default);

bool bRBAN_IncludeClothColliders = true;
FAutoConsoleVariableRef CVarRigidBodyNodeIncludeClothColliders(TEXT("p.RigidBodyNode.IncludeClothColliders"), bRBAN_IncludeClothColliders, TEXT("Include cloth colliders as kinematic bodies in the immediate physics simulation."), ECVF_Default);

// FSimSpaceSettings forced overrides for testing

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:728

Scope (from outer to inner):

file
function     void FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread

Source code excerpt:

				CapturedBoneVelocityPose.Empty();
			}
			else if ((SimulationSpace != ESimulationSpace::WorldSpace) && bRBAN_EnableComponentAcceleration)
			{
				const FVector UseComponentLinearVelScale = (RBAN_Override_ComponentLinearVelScale >= 0) ? FVector(RBAN_Override_ComponentLinearVelScale) : ComponentLinearVelScale;
				const FVector UseComponentLinearAccScale = (RBAN_Override_ComponentLinearAccScale >= 0) ? FVector(RBAN_Override_ComponentLinearAccScale) : ComponentLinearAccScale;
				const FVector UseComponentAppliedLinearAccClamp = (RBAN_Override_ComponentAppliedLinearAccClamp >= 0) ? FVector(RBAN_Override_ComponentAppliedLinearAccClamp) : ComponentAppliedLinearAccClamp;

				if (!UseComponentLinearVelScale.IsNearlyZero() || !UseComponentLinearAccScale.IsNearlyZero())