p.Chaos.Collision.OneSidedHeightField
p.Chaos.Collision.OneSidedHeightField
#Overview
name: p.Chaos.Collision.OneSidedHeightField
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.OneSidedHeightField is to control one-sided collision behavior for height fields in the Chaos physics system of Unreal Engine 5. This setting variable is part of the collision detection and response system within the Chaos physics module.
-
The Chaos physics subsystem, specifically the collision detection and response module, relies on this setting variable.
-
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
-
This variable interacts closely with bChaos_Collision_OneSidedHeightField, which is the actual boolean variable used in the code to determine the behavior.
-
Developers must be aware that this variable affects the collision behavior of height fields. When set to true, it enables one-sided collision for height fields, meaning collisions will only occur from one side of the height field surface.
-
Best practices when using this variable include:
- Consider the desired collision behavior for your specific use case.
- Be consistent in its usage across your project to avoid unexpected behavior.
- Test thoroughly with both enabled and disabled states to ensure proper physics behavior.
Regarding the associated variable bChaos_Collision_OneSidedHeightField:
-
The purpose of bChaos_Collision_OneSidedHeightField is to store the actual boolean value that determines whether one-sided collision for height fields is enabled.
-
It is used directly in the Chaos physics code, particularly in collision detection algorithms for height fields.
-
The value is set through the console variable p.Chaos.Collision.OneSidedHeightField.
-
This variable interacts with the collision detection logic, specifically in the GJKContactPointImp function of the FHeightField class.
-
Developers should be aware that changing this variable will directly affect the collision behavior of height fields in their scenes.
-
Best practices include:
- Use this variable in conjunction with other collision settings for consistent behavior.
- Consider performance implications when enabling or disabling one-sided collisions.
- Ensure that the desired collision behavior aligns with the visual representation of the height field in the game world.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:118
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
bool bChaos_Collision_OneSidedHeightField = true;
FAutoConsoleVariableRef CVarChaos_Collision_OneSidedTriangleMesh(TEXT("p.Chaos.Collision.OneSidedTriangleMesh"), bChaos_Collision_OneSidedTriangleMesh, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_OneSidedHeightfield(TEXT("p.Chaos.Collision.OneSidedHeightField"), bChaos_Collision_OneSidedHeightField, TEXT(""));
// Ueed to reject contacts against tri meshes
FRealSingle Chaos_Collision_TriMeshPhiToleranceScale = 1.0f; // A multipler on cull distance. Points farther than this from the deepest point are ignored
FRealSingle Chaos_Collision_TriMeshDistanceTolerance = 0.1f; // Points closer than this to a deeper point are ignored
FAutoConsoleVariableRef CVarChaos_Collision_TriMeshDistanceolerance(TEXT("p.Chaos.Collision.TriangeMeshDistanceTolerance"), Chaos_Collision_TriMeshDistanceTolerance, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_TriMeshPhiToleranceScale(TEXT("p.Chaos.Collision.TriangeMeshPhiToleranceScale"), Chaos_Collision_TriMeshPhiToleranceScale, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_Collision_OneSidedHeightField
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:116
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
bool bChaos_Collision_OneSidedTriangleMesh = true;
bool bChaos_Collision_OneSidedHeightField = true;
FAutoConsoleVariableRef CVarChaos_Collision_OneSidedTriangleMesh(TEXT("p.Chaos.Collision.OneSidedTriangleMesh"), bChaos_Collision_OneSidedTriangleMesh, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_OneSidedHeightfield(TEXT("p.Chaos.Collision.OneSidedHeightField"), bChaos_Collision_OneSidedHeightField, TEXT(""));
// Ueed to reject contacts against tri meshes
FRealSingle Chaos_Collision_TriMeshPhiToleranceScale = 1.0f; // A multipler on cull distance. Points farther than this from the deepest point are ignored
FRealSingle Chaos_Collision_TriMeshDistanceTolerance = 0.1f; // Points closer than this to a deeper point are ignored
FAutoConsoleVariableRef CVarChaos_Collision_TriMeshDistanceolerance(TEXT("p.Chaos.Collision.TriangeMeshDistanceTolerance"), Chaos_Collision_TriMeshDistanceTolerance, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_TriMeshPhiToleranceScale(TEXT("p.Chaos.Collision.TriangeMeshPhiToleranceScale"), Chaos_Collision_TriMeshPhiToleranceScale, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifoldsMeshShapes.cpp:30
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
{
extern bool bChaos_Collision_OneSidedTriangleMesh;
extern bool bChaos_Collision_OneSidedHeightField;
extern FRealSingle Chaos_Collision_TriMeshDistanceTolerance;
extern FRealSingle Chaos_Collision_TriMeshPhiToleranceScale;
extern int32 Chaos_Collision_MeshManifoldHashSize;
extern bool bChaos_Collision_EnableMeshManifoldOptimizedLoop;
extern bool bChaos_Collision_EnableMeshManifoldOptimizedLoop_TriMesh;
extern bool bChaos_Collision_EnableMACDFallback;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/HeightField.cpp:30
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
extern FRealSingle Chaos_Collision_EdgePrunePlaneDistance;
extern bool bChaos_Collision_OneSidedHeightField;
class FHeightfieldRaycastVisitor
{
public:
FHeightfieldRaycastVisitor(const typename FHeightField::FDataType* InData, const FVec3& InStart, const FVec3& InDir, const FReal InThickness)
: OutTime(TNumericLimits<FReal>::Max())
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/HeightField.cpp:1795
Scope (from outer to inner):
file
namespace Chaos
function bool FHeightField::GJKContactPointImp
lambda-function
Source code excerpt:
if (GJKPenetration(TriangleConvex, QueryGeom, QueryTM, Penetration, ClosestA, ClosestB, Normal, ClosestVertexIndexA, ClosestVertexIndexB, (FReal)0))
{
const bool bOneSidedCollision = bChaos_Collision_OneSidedHeightField;
const bool bSkipOneSided = (bOneSidedCollision && (FVec3::DotProduct(TriNormal, Normal) < 0));
if (!bSkipOneSided)
{
LocalContactLocation = ClosestB;
LocalContactNormal = Normal;
LocalContactPhi = -Penetration;