p.RigidBodyNode.IncludeClothColliders

p.RigidBodyNode.IncludeClothColliders

#Overview

name: p.RigidBodyNode.IncludeClothColliders

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.IncludeClothColliders is to control whether cloth colliders are included as kinematic bodies in the immediate physics simulation within the Unreal Engine’s animation system, specifically in the RigidBody animation node.

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 for skeletal animations.

The value of this variable is set through a console variable (CVar) system, allowing it to be modified at runtime. It’s initialized with a default value of true, meaning cloth colliders are included by default.

The associated variable bRBAN_IncludeClothColliders interacts directly with p.RigidBodyNode.IncludeClothColliders. They share the same value, with bRBAN_IncludeClothColliders being the actual boolean flag used in the code logic.

Developers must be aware that this variable affects performance and simulation accuracy. Including cloth colliders in the rigid body simulation can increase the physical accuracy of the animation, especially in scenarios where characters with cloth elements interact with the environment. However, it may also increase the computational cost of the simulation.

Best practices when using this variable include:

  1. Consider the performance implications of enabling cloth colliders in the rigid body simulation, especially for scenes with many animated characters.
  2. Test the visual and physical behavior of animations with this setting both enabled and disabled to determine the best setting for your specific use case.
  3. Use this in conjunction with other cloth simulation settings to achieve the desired balance between performance and visual fidelity.

Regarding the associated variable bRBAN_IncludeClothColliders:

#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:64

Scope: file

Source code excerpt:


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
bool bRBAN_SimSpace_EnableOverride = false;
float RBAN_SimSpaceOverride_WorldAlpha = -1.0f;
float RBAN_SimSpaceOverride_VelocityScaleZ = -1.0f;
float RBAN_SimSpaceOverride_MaxLinearVelocity = -1.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

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
bool bRBAN_SimSpace_EnableOverride = false;
float RBAN_SimSpaceOverride_WorldAlpha = -1.0f;
float RBAN_SimSpaceOverride_VelocityScaleZ = -1.0f;
float RBAN_SimSpaceOverride_MaxLinearVelocity = -1.0f;

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

Scope (from outer to inner):

file
function     void FAnimNode_RigidBody::CollectClothColliderObjects

Source code excerpt:

void FAnimNode_RigidBody::CollectClothColliderObjects(const USkeletalMeshComponent* SkeletalMeshComp)
{
	if (bUseExternalClothCollision && bRBAN_IncludeClothColliders && SkeletalMeshComp && PhysicsSimulation)
	{
		const TArray<FClothCollisionSource>& SkeletalMeshClothCollisionSources = SkeletalMeshComp->GetClothCollisionSources();
		
		for (const FClothCollisionSource& ClothCollisionSource : SkeletalMeshClothCollisionSources)
		{
			const USkeletalMeshComponent* const SourceComponent = ClothCollisionSource.SourceComponent.Get();