UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FKConvexElem Struct Reference

#include <ConvexElem.h>

+ Inheritance diagram for FKConvexElem:

Public Types

enum class  EConvexDataUpdateMethod { UpdateConvexDataOnlyIfMissing = 0 , AlwaysUpdateConvexData }
 

Public Member Functions

ENGINE_API FKConvexElem ()
 
ENGINE_API FKConvexElem (const FKConvexElem &Other)
 
ENGINE_API ~FKConvexElem ()
 
ENGINE_API const FKConvexElemoperator= (const FKConvexElem &Other)
 
ENGINE_API void DrawElemWire (class FPrimitiveDrawInterface *PDI, const FTransform &ElemTM, const float Scale, const FColor Color) const override
 
ENGINE_API void DrawElemSolid (class FPrimitiveDrawInterface *PDI, const FTransform &ElemTM, const float Scale, const FMaterialRenderProxy *MaterialRenderProxy) const override
 
ENGINE_API void AddCachedSolidConvexGeom (TArray< FDynamicMeshVertex > &VertexBuffer, TArray< uint32 > &IndexBuffer, const FColor VertexColor) const
 
ENGINE_API void Reset ()
 
ENGINE_API void UpdateElemBox ()
 
ENGINE_API FBox CalcAABB (const FTransform &BoneTM, const FVector &Scale3D) const
 
ENGINE_API void GetPlanes (TArray< FPlane > &Planes) const
 
ENGINE_API bool HullFromPlanes (const TArray< FPlane > &InPlanes, const TArray< FVector > &SnapVerts, float InSnapDistance=UE_SMALL_NUMBER)
 
ENGINE_API void ConvexFromBoxElem (const FKBoxElem &InBox)
 
ENGINE_API void BakeTransformToVerts ()
 
FVector::FReal GetVolume (const FVector &Scale) const
 
FVector::FReal GetScaledVolume (const FVector &Scale3D) const
 
const autoGetChaosConvexMesh () const
 
void SetChaosConvexMesh (TSharedPtr< Chaos::FConvex, ESPMode::ThreadSafe > &&InChaosConvex, EConvexDataUpdateMethod ConvexDataUpdateMethod=EConvexDataUpdateMethod::AlwaysUpdateConvexData)
 
ENGINE_API void SetConvexMeshObject (Chaos::FConvexPtr &&InChaosConvex, EConvexDataUpdateMethod ConvexDataUpdateMethod=EConvexDataUpdateMethod::AlwaysUpdateConvexData)
 
ENGINE_API void ResetChaosConvexMesh ()
 
ENGINE_API void ComputeChaosConvexIndices (bool bForceCompute=false)
 
ENGINE_API TArray< int32GetChaosConvexIndices () const
 
virtual FTransform GetTransform () const override final
 
void SetTransform (const FTransform &InTransform)
 
ENGINE_API void ScaleElem (FVector DeltaSize, float MinSize)
 
ENGINE_API float GetClosestPointAndNormal (const FVector &WorldPosition, const FTransform &BodyToWorldTM, FVector &ClosestWorldPosition, FVector &Normal) const
 
ENGINE_API float GetShortestDistanceToPoint (const FVector &WorldPosition, const FTransform &BodyToWorldTM) const
 
- Public Member Functions inherited from FKShapeElem
 FKShapeElem ()
 
 FKShapeElem (EAggCollisionShape::Type InShapeType)
 
 FKShapeElem (const FKShapeElem &Copy)
 
virtual ENGINE_API ~FKShapeElem ()
 
const FKShapeElemoperator= (const FKShapeElem &Other)
 
template<typename T >
T * GetShapeCheck ()
 
const FUserDataGetUserData () const
 
const FNameGetName () const
 
void SetName (const FName &InName)
 
EAggCollisionShape::Type GetShapeType () const
 
bool GetContributeToMass () const
 
void SetContributeToMass (bool bInContributeToMass)
 
void SetCollisionEnabled (ECollisionEnabled::Type InCollisionEnabled)
 
ECollisionEnabled::Type GetCollisionEnabled () const
 
virtual void DrawElemSolid (class FPrimitiveDrawInterface *PDI, const FTransform &ElemTM, const float Scale, const class FMaterialRenderProxy *MaterialRenderProxy) const
 

Public Attributes

TArray< FVectorVertexData
 
TArray< int32IndexData
 
FBox ElemBox
 
- Public Attributes inherited from FKShapeElem
float RestOffset
 

Static Public Attributes

static ENGINE_API EAggCollisionShape::Type StaticShapeType = EAggCollisionShape::Convex
 
- Static Public Attributes inherited from FKShapeElem
static ENGINE_API EAggCollisionShape::Type StaticShapeType = EAggCollisionShape::Unknown
 

Friends

FArchiveoperator<< (FArchive &Ar, FKConvexElem &Elem)
 

Additional Inherited Members

- Protected Member Functions inherited from FKShapeElem
void CloneElem (const FKShapeElem &Other)
 

Detailed Description

One convex hull, used for simplified collision.

Member Enumeration Documentation

◆ EConvexDataUpdateMethod

Enumerator
UpdateConvexDataOnlyIfMissing 

Update convex index and vertex data from the chaos convex object only if they are missing

AlwaysUpdateConvexData 

Always convex recompute index and vertex data from the set chaos convex object

Constructor & Destructor Documentation

◆ FKConvexElem() [1/2]

FKConvexElem::FKConvexElem ( )

◆ FKConvexElem() [2/2]

FKConvexElem::FKConvexElem ( const FKConvexElem Other)

◆ ~FKConvexElem()

FKConvexElem::~FKConvexElem ( )

Member Function Documentation

◆ AddCachedSolidConvexGeom()

void FKConvexElem::AddCachedSolidConvexGeom ( TArray< FDynamicMeshVertex > &  VertexBuffer,
TArray< uint32 > &  IndexBuffer,
const FColor  VertexColor 
) const

◆ BakeTransformToVerts()

void FKConvexElem::BakeTransformToVerts ( )

Apply current element transform to verts, and reset transform to identity

◆ CalcAABB()

FBox FKConvexElem::CalcAABB ( const FTransform BoneTM,
const FVector Scale3D 
) const

Calculate a bounding box for this convex element with the specified transform and scale

◆ ComputeChaosConvexIndices()

ENGINE_API void FKConvexElem::ComputeChaosConvexIndices ( bool  bForceCompute = false)

◆ ConvexFromBoxElem()

void FKConvexElem::ConvexFromBoxElem ( const FKBoxElem InBox)

Utility for setting this convex element to match a supplied box element. Also copies transform.

◆ DrawElemSolid()

void FKConvexElem::DrawElemSolid ( class FPrimitiveDrawInterface PDI,
const FTransform ElemTM,
const float  Scale,
const FMaterialRenderProxy MaterialRenderProxy 
) const
override

◆ DrawElemWire()

void FKConvexElem::DrawElemWire ( class FPrimitiveDrawInterface PDI,
const FTransform ElemTM,
const float  Scale,
const FColor  Color 
) const
overridevirtual

Reimplemented from FKShapeElem.

◆ GetChaosConvexIndices()

TArray< int32 > FKConvexElem::GetChaosConvexIndices ( ) const

◆ GetChaosConvexMesh()

const auto & FKConvexElem::GetChaosConvexMesh ( ) const
inline

◆ GetClosestPointAndNormal()

float FKConvexElem::GetClosestPointAndNormal ( const FVector WorldPosition,
const FTransform BodyToWorldTM,
FVector ClosestWorldPosition,
FVector Normal 
) const

Finds the closest point on the shape given a world position. Input and output are given in world space

Parameters
WorldPositionThe point we are trying to get close to
BodyToWorldTMThe transform to convert BodySetup into world space
ClosestWorldPositionThe closest point on the shape in world space
NormalThe normal of the feature associated with ClosestWorldPosition.
Returns
The distance between WorldPosition and the shape. 0 indicates WorldPosition is inside the shape.

◆ GetPlanes()

void FKConvexElem::GetPlanes ( TArray< FPlane > &  Planes) const

Get set of planes that define this convex hull

◆ GetScaledVolume()

FVector::FReal FKConvexElem::GetScaledVolume ( const FVector Scale3D) const

Returns the volume of this element

◆ GetShortestDistanceToPoint()

float FKConvexElem::GetShortestDistanceToPoint ( const FVector WorldPosition,
const FTransform BodyToWorldTM 
) const

Finds the shortest distance between the element and a world position. Input and output are given in world space

Parameters
WorldPositionThe point we are trying to get close to
BodyToWorldTMThe transform to convert BodySetup into world space
Returns
The distance between WorldPosition and the shape. 0 indicates WorldPosition is inside one of the shapes.

◆ GetTransform()

virtual FTransform FKConvexElem::GetTransform ( ) const
inlinefinaloverridevirtual

Get current transform applied to convex mesh vertices

Reimplemented from FKShapeElem.

◆ GetVolume()

FVector::FReal FKConvexElem::GetVolume ( const FVector Scale) const

Returns the volume of this element

◆ HullFromPlanes()

bool FKConvexElem::HullFromPlanes ( const TArray< FPlane > &  InPlanes,
const TArray< FVector > &  SnapVerts,
float  InSnapDistance = UE_SMALL_NUMBER 
)

Utility for creating a convex hull from a set of planes. Will reset current state of this elem.

◆ operator=()

const FKConvexElem & FKConvexElem::operator= ( const FKConvexElem Other)

◆ Reset()

void FKConvexElem::Reset ( )

Reset the hull to empty all arrays

◆ ResetChaosConvexMesh()

void FKConvexElem::ResetChaosConvexMesh ( )

◆ ScaleElem()

void FKConvexElem::ScaleElem ( FVector  DeltaSize,
float  MinSize 
)

◆ SetChaosConvexMesh()

void FKConvexElem::SetChaosConvexMesh ( TSharedPtr< Chaos::FConvex, ESPMode::ThreadSafe > &&  InChaosConvex,
EConvexDataUpdateMethod  ConvexDataUpdateMethod = EConvexDataUpdateMethod::AlwaysUpdateConvexData 
)
inline

Set the chaos convex mesh Note : This will by default invalidate the convex data and recompute them by calling ComputeChaosConvexIndices Only set ConvexDataUpdateMethod to UpdateConvexDataOnlyIfMissing if you know the data is up to date with the chaos convex object or if you plan to call ComputeChaosConvexIndices later

Parameters
InChaosConvexChaos convex mesh to set
ConvexDataUpdateMethodmethod to use to update internal convex data

◆ SetConvexMeshObject()

void FKConvexElem::SetConvexMeshObject ( Chaos::FConvexPtr &&  InChaosConvex,
EConvexDataUpdateMethod  ConvexDataUpdateMethod = EConvexDataUpdateMethod::AlwaysUpdateConvexData 
)

◆ SetTransform()

void FKConvexElem::SetTransform ( const FTransform InTransform)
inline

Modify the transform to apply to convex mesh vertices NOTE: When doing this, BodySetup convex meshes need to be recooked - usually by calling InvalidatePhysicsData() and CreatePhysicsMeshes()

◆ UpdateElemBox()

void FKConvexElem::UpdateElemBox ( )

Updates internal ElemBox based on current value of VertexData

Friends And Related Symbol Documentation

◆ operator<<

FArchive & operator<< ( FArchive Ar,
FKConvexElem Elem 
)
friend

Member Data Documentation

◆ ElemBox

FBox FKConvexElem::ElemBox

Bounding box of this convex hull.

◆ IndexData

TArray<int32> FKConvexElem::IndexData

◆ StaticShapeType

EAggCollisionShape::Type FKConvexElem::StaticShapeType = EAggCollisionShape::Convex
static

◆ VertexData

TArray<FVector> FKConvexElem::VertexData

Array of indices that make up the convex hull.


The documentation for this struct was generated from the following files: