p.LevelsetOverlapCapsuleSamples

p.LevelsetOverlapCapsuleSamples

#Overview

name: p.LevelsetOverlapCapsuleSamples

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.LevelsetOverlapCapsuleSamples is to control the number of spiral points generated for levelset-capsule overlaps in the Chaos physics system of Unreal Engine 5. This setting is used to determine the sampling resolution when calculating intersections between levelsets and capsules.

This setting variable is primarily used in the Chaos physics module, which is part of Unreal Engine’s experimental physics system. Based on the callsites, it’s specifically utilized in the Levelset.cpp file within the Chaos namespace.

The value of this variable is set through a console variable (CVar) system, which allows for runtime modification. It’s initialized with a default value of 24 and can be changed during runtime or through configuration files.

The associated variable NumOverlapCapsuleSamples directly interacts with p.LevelsetOverlapCapsuleSamples. They share the same value, with NumOverlapCapsuleSamples being the actual variable used in the code, while p.LevelsetOverlapCapsuleSamples is the console variable name for external access and modification.

Developers should be aware that this variable affects the accuracy and performance of levelset-capsule overlap calculations. A higher value will provide more accurate results but at the cost of increased computational overhead.

Best practices when using this variable include:

  1. Balancing accuracy and performance based on the specific needs of the game or simulation.
  2. Testing different values to find the optimal balance for your specific use case.
  3. Considering the impact on performance, especially in scenes with many capsule collisions.
  4. Using the console variable for easy tweaking and testing during development.

Regarding the associated variable NumOverlapCapsuleSamples:

The purpose of NumOverlapCapsuleSamples is to store the actual number of spiral points used for levelset-capsule overlaps in the Chaos physics system.

This variable is used directly in the Chaos physics module, specifically in the Levelset.cpp file. It’s used in the GetGeomSurfaceSamplesExtended function for FCapsule objects.

The value of NumOverlapCapsuleSamples is set by the console variable p.LevelsetOverlapCapsuleSamples, allowing for easy modification during runtime or through configuration files.

As mentioned earlier, it directly interacts with p.LevelsetOverlapCapsuleSamples, sharing the same value.

Developers should be aware that modifying NumOverlapCapsuleSamples directly in code won’t have the desired effect, as its value is controlled by the console variable.

Best practices for NumOverlapCapsuleSamples include:

  1. Using the console variable p.LevelsetOverlapCapsuleSamples to modify its value instead of changing it directly in code.
  2. Considering its impact on both accuracy and performance when adjusting its value.
  3. Documenting any specific values used in different scenarios for easier tuning and debugging.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:35

Scope: file

Source code excerpt:


int32 NumOverlapCapsuleSamples = 24;
FAutoConsoleVariableRef CVarNumOverlapCapsuleSamples(TEXT("p.LevelsetOverlapCapsuleSamples"), NumOverlapCapsuleSamples, TEXT("Number of spiral points to generate for levelset-capsule overlaps"));

#define MAX_CLAMP(a, comp, b) (a >= comp ? b : a)
#define MIN_CLAMP(a, comp, b) (a < comp ? b : a)
#define RANGE_CLAMP(a, comp, b) ((a < 0 || comp <= a) ? b : a)

namespace Chaos

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:34

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarNumOverlapSphereSamples(TEXT("p.LevelsetOverlapSphereSamples"), NumOverlapSphereSamples, TEXT("Number of spiral points to generate for levelset-sphere overlaps"));

int32 NumOverlapCapsuleSamples = 24;
FAutoConsoleVariableRef CVarNumOverlapCapsuleSamples(TEXT("p.LevelsetOverlapCapsuleSamples"), NumOverlapCapsuleSamples, TEXT("Number of spiral points to generate for levelset-capsule overlaps"));

#define MAX_CLAMP(a, comp, b) (a >= comp ? b : a)
#define MIN_CLAMP(a, comp, b) (a < comp ? b : a)
#define RANGE_CLAMP(a, comp, b) ((a < 0 || comp <= a) ? b : a)

namespace Chaos

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Levelset.cpp:1712

Scope (from outer to inner):

file
namespace    Chaos
function     void GetGeomSurfaceSamplesExtended

Source code excerpt:

void GetGeomSurfaceSamplesExtended(const FCapsule& InGeom, TArray<FVec3>& OutSamples)
{
	OutSamples = InGeom.ComputeLocalSamplePoints(NumOverlapCapsuleSamples);
}

void GetGeomSurfaceSamplesExtended(const FConvex& InGeom, TArray<FVec3>& OutSamples)
{
	// Convex doesn't have extended samples
	GetGeomSurfaceSamples(InGeom, OutSamples);