UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FGeometryCollectionConvexUtility Class Reference

#include <GeometryCollectionConvexUtility.h>

Classes

struct  FClusterConvexHullSettings
 
struct  FConvexDecompositionSettings
 
struct  FGeometryCollectionConvexData
 
struct  FIntersectionFilters
 
struct  FLeafConvexHullSettings
 
struct  FMergeConvexHullSettings
 
struct  FSphereCoveringInfo
 
struct  FTransformedConvex
 

Static Public Member Functions

static CHAOS_API FGeometryCollectionConvexData GetValidConvexHullData (FGeometryCollection *GeometryCollection)
 
static CHAOS_API TOptional< FGeometryCollectionConvexDataGetConvexHullDataIfPresent (FManagedArrayCollection *GeometryCollection)
 
static CHAOS_API bool HasConvexHullData (const FManagedArrayCollection *GeometryCollection)
 
static CHAOS_API FGeometryCollectionConvexData CreateNonOverlappingConvexHullData (FGeometryCollection *GeometryCollection, double FractionAllowRemove=.3, double SimplificationDistanceThreshold=0.0, double CanExceedFraction=.5, EConvexOverlapRemoval OverlapRemovalMethod=EConvexOverlapRemoval::All, double OverlapRemovalShrinkPercent=0.0, UE::GeometryCollectionConvexUtility::FConvexHulls *ComputedLeafHullsToModify=nullptr)
 
static CHAOS_API void GenerateClusterConvexHullsFromChildrenHulls (FGeometryCollection &Collection, const FClusterConvexHullSettings &Settings, const TArrayView< const int32 > TransformSubset)
 
static CHAOS_API void GenerateClusterConvexHullsFromChildrenHulls (FGeometryCollection &Collection, const FClusterConvexHullSettings &Settings)
 
static CHAOS_API void GenerateClusterConvexHullsFromLeafHulls (FGeometryCollection &Collection, const FClusterConvexHullSettings &Settings, const TArrayView< const int32 > OptionalTransformSubset)
 
static CHAOS_API void GenerateClusterConvexHullsFromLeafHulls (FGeometryCollection &Collection, const FClusterConvexHullSettings &Settings)
 
static CHAOS_API void MergeHullsOnTransforms (FManagedArrayCollection &Collection, const FGeometryCollectionConvexUtility::FMergeConvexHullSettings &Settings, bool bRestrictToSelection, const TArrayView< const int32 > OptionalTransformSelection, UE::Geometry::FSphereCovering *OptionalSphereCoveringOut=nullptr)
 
static CHAOS_API void GenerateLeafConvexHulls (FGeometryCollection &Collection, bool bRestrictToSelection, const TArrayView< const int32 > TransformSubset, const FLeafConvexHullSettings &Settings, TArray< FSphereCoveringInfo > *OutComputedNavigableSpheres=nullptr)
 
static CHAOS_API Chaos::FConvexPtr GetConvexHull (const FGeometryCollection *GeometryCollection, int32 GeometryIndex)
 
static TUniquePtr< Chaos::FConvexFindConvexHull (const FGeometryCollection *GeometryCollection, int32 GeometryIndex)
 
static CHAOS_API bool CopyConvexHulls (FManagedArrayCollection &Collection, const TArray< int32 > &TransformIndices, const FManagedArrayCollection &SourceCollection, const TArray< int32 > &SourceTransformIndices, bool bSkipIfEmpty=false)
 
static CHAOS_API void RemoveConvexHulls (FManagedArrayCollection *GeometryCollection, const TArray< int32 > &TransformsToClearHullsFrom)
 
static CHAOS_API void RemoveEmptyConvexHulls (FManagedArrayCollection &GeometryCollection)
 
static CHAOS_API void SetDefaults (FGeometryCollection *GeometryCollection, FName Group, uint32 StartSize, uint32 NumElements)
 
static CHAOS_API TManagedArray< int32 > * GetCustomConvexFlags (FGeometryCollection *GeometryCollection, bool bAddIfMissing=false)
 
static CHAOS_API bool ValidateConvexData (const FManagedArrayCollection *GeometryCollection)
 
static CHAOS_API void SetVolumeAttributes (FManagedArrayCollection *Collection)
 
static CHAOS_API void CopyChildConvexes (const FGeometryCollection *FromCollection, const TArrayView< const int32 > &FromTransformIdx, FGeometryCollection *ToCollection, const TArrayView< const int32 > &ToTransformIdx, bool bLeafOnly)
 
static CHAOS_API UE::GeometryCollectionConvexUtility::FConvexHulls ComputeLeafHulls (FGeometryCollection *GeometryCollection, const TArray< FTransform > &GlobalTransformArray, double SimplificationDistanceThreshold=0.0, double OverlapRemovalShrinkPercent=0.0, TFunction< bool(int32)> SkipBoneFn=nullptr, const FConvexDecompositionSettings *OptionalDecompositionSettings=nullptr, const TArray< FTransformedConvex > *OptionalIntersectConvexHulls=nullptr, const TArray< TSet< int32 > > *OptionalTransformToIntersectHulls=nullptr, TArray< FGeometryCollectionConvexUtility::FSphereCoveringInfo > *OutComputedNavigableSpheres=nullptr)
 
static CHAOS_API void ConvertImplicitToConvexArray (const Chaos::FImplicitObject &InImplicit, const FTransform &Transform, TArray< FTransformedConvex > &InOutConvex)
 

Member Function Documentation

◆ ComputeLeafHulls()

UE::GeometryCollectionConvexUtility::FConvexHulls FGeometryCollectionConvexUtility::ComputeLeafHulls ( FGeometryCollection GeometryCollection,
const TArray< FTransform > &  GlobalTransformArray,
double  SimplificationDistanceThreshold = 0.0,
double  OverlapRemovalShrinkPercent = 0.0,
TFunction< bool(int32)>  SkipBoneFn = nullptr,
const FConvexDecompositionSettings OptionalDecompositionSettings = nullptr,
const TArray< FTransformedConvex > *  OptionalIntersectConvexHulls = nullptr,
const TArray< TSet< int32 > > *  OptionalTransformToIntersectHulls = nullptr,
TArray< FGeometryCollectionConvexUtility::FSphereCoveringInfo > *  OutComputedNavigableSpheres = nullptr 
)
static

◆ ConvertImplicitToConvexArray()

void FGeometryCollectionConvexUtility::ConvertImplicitToConvexArray ( const Chaos::FImplicitObject InImplicit,
const FTransform Transform,
TArray< FTransformedConvex > &  InOutConvex 
)
static

◆ CopyChildConvexes()

void FGeometryCollectionConvexUtility::CopyChildConvexes ( const FGeometryCollection FromCollection,
const TArrayView< const int32 > &  FromTransformIdx,
FGeometryCollection ToCollection,
const TArrayView< const int32 > &  ToTransformIdx,
bool  bLeafOnly 
)
static

Copy convex hulls from below FromTransformIdx over to all live at ToTransformIdx. The two geometry collections can be the same but do not need to be. Note: This will also set HasCustomConvex flags for the ToTransformIdx.

Parameters
FromCollectionThe collection to copy from
FromTransformIdxThe transform indices whose child nodes should be copied from (or, if it's a leaf, the hull on the leaf will be copied instead)
ToCollectionThe collection to copy to (can be the same as FromCollection)
ToTransformIdxThe transform indices whose convexes will be replaced with copies of the child convexes. Must be same length as FromTransformIdx; can be the same array.
bLeafOnlyIf true, we will only collect convexes from leaf bones, not from clusters.

◆ CopyConvexHulls()

bool FGeometryCollectionConvexUtility::CopyConvexHulls ( FManagedArrayCollection Collection,
const TArray< int32 > &  TransformIndices,
const FManagedArrayCollection SourceCollection,
const TArray< int32 > &  SourceTransformIndices,
bool  bSkipIfEmpty = false 
)
static

Copy convex hulls on the specified transforms from a source collection to the collection

Parameters
GeometryCollectionThe collection to copy convex hulls to
TransformIndicesThe transforms on the GeometryCollection to update w/ copied convex hulls. Must be same length as SourceTransformIndices array.
SourceCollectionThe collection to copy convex hulls from
SourceTransformIndicesThe transforms on the SourceCollection to copy from. Must be same length as TransformIndices array.
bSkipIfEmptyWhether to skip copying from transforms that have no convex hulls

◆ CreateNonOverlappingConvexHullData()

FGeometryCollectionConvexUtility::FGeometryCollectionConvexData FGeometryCollectionConvexUtility::CreateNonOverlappingConvexHullData ( FGeometryCollection GeometryCollection,
double  FractionAllowRemove = .3,
double  SimplificationDistanceThreshold = 0.0,
double  CanExceedFraction = .5,
EConvexOverlapRemoval  OverlapRemovalMethod = EConvexOverlapRemoval::All,
double  OverlapRemovalShrinkPercent = 0.0,
UE::GeometryCollectionConvexUtility::FConvexHulls ComputedLeafHullsToModify = nullptr 
)
static

Create non-overlapping convex hull data for all transforms in the geometry collection (except transforms where it would be better to just use the hulls of the children)

Parameters
GeometryCollectionThe collection to add convex hulls to
FractionAllowRemoveThe fraction of a convex body we can cut away to remove overlaps with neighbors, before we fall back to using the hulls of the children directly. (Does not affect leaves of hierarchy)
SimplificationDistanceThresholdApproximate minimum distance between vertices, below which we remove vertices to generate a simpler convex shape. If 0.0, no simplification will occur.
CanExceedFractionThe fraction by which the convex body volume on a cluster can exceed the volume of the geometry under that cluster (a value of 1 == exceed by 100% == convex hull has 2x the volume of the geometry)
OverlapRemovalMethodIf bRemoveOverlaps, control which overlaps are removed
OverlapRemovalShrinkPercentCompute overlaps based on objects shrunk by this percentage, so objects that would not overlap with this value set as their 'Collision Object Reduction Percentage' will not be cut
ComputedLeafHullsToModifyOptional pre-computed hulls for geometry of rigid leaves, in the top-level coordinate space of the geometry collection. If passed in, the data will be updated and moved.

◆ FindConvexHull()

static TUniquePtr< Chaos::FConvex > FGeometryCollectionConvexUtility::FindConvexHull ( const FGeometryCollection GeometryCollection,
int32  GeometryIndex 
)
inlinestatic

◆ GenerateClusterConvexHullsFromChildrenHulls() [1/2]

void FGeometryCollectionConvexUtility::GenerateClusterConvexHullsFromChildrenHulls ( FGeometryCollection Collection,
const FClusterConvexHullSettings Settings 
)
static

◆ GenerateClusterConvexHullsFromChildrenHulls() [2/2]

void FGeometryCollectionConvexUtility::GenerateClusterConvexHullsFromChildrenHulls ( FGeometryCollection Collection,
const FClusterConvexHullSettings Settings,
const TArrayView< const int32 TransformSubset 
)
static

◆ GenerateClusterConvexHullsFromLeafHulls() [1/2]

void FGeometryCollectionConvexUtility::GenerateClusterConvexHullsFromLeafHulls ( FGeometryCollection Collection,
const FClusterConvexHullSettings Settings 
)
static

◆ GenerateClusterConvexHullsFromLeafHulls() [2/2]

void FGeometryCollectionConvexUtility::GenerateClusterConvexHullsFromLeafHulls ( FGeometryCollection Collection,
const FClusterConvexHullSettings Settings,
const TArrayView< const int32 OptionalTransformSubset 
)
static

◆ GenerateLeafConvexHulls()

void FGeometryCollectionConvexUtility::GenerateLeafConvexHulls ( FGeometryCollection Collection,
bool  bRestrictToSelection,
const TArrayView< const int32 TransformSubset,
const FLeafConvexHullSettings Settings,
TArray< FSphereCoveringInfo > *  OutComputedNavigableSpheres = nullptr 
)
static

◆ GetConvexHull()

Chaos::FConvexPtr FGeometryCollectionConvexUtility::GetConvexHull ( const FGeometryCollection GeometryCollection,
int32  GeometryIndex 
)
static

Returns the convex hull of the vertices contained in the specified geometry.

◆ GetConvexHullDataIfPresent()

TOptional< FGeometryCollectionConvexUtility::FGeometryCollectionConvexData > FGeometryCollectionConvexUtility::GetConvexHullDataIfPresent ( FManagedArrayCollection GeometryCollection)
static

Get convex hull data for the Geometry Collection if it is present

◆ GetCustomConvexFlags()

TManagedArray< int32 > * FGeometryCollectionConvexUtility::GetCustomConvexFlags ( FGeometryCollection GeometryCollection,
bool  bAddIfMissing = false 
)
static

Get the HasCustomConvex flags. If they're missing, either add them (if bAddIfMissing) or return nullptr

◆ GetValidConvexHullData()

FGeometryCollectionConvexUtility::FGeometryCollectionConvexData FGeometryCollectionConvexUtility::GetValidConvexHullData ( FGeometryCollection GeometryCollection)
static

Ensure that convex hull data exists for the Geometry Collection and construct it if not (or if some data is missing.

◆ HasConvexHullData()

bool FGeometryCollectionConvexUtility::HasConvexHullData ( const FManagedArrayCollection GeometryCollection)
static
Returns
true if convex hull data is present

◆ MergeHullsOnTransforms()

void FGeometryCollectionConvexUtility::MergeHullsOnTransforms ( FManagedArrayCollection Collection,
const FGeometryCollectionConvexUtility::FMergeConvexHullSettings Settings,
bool  bRestrictToSelection,
const TArrayView< const int32 OptionalTransformSelection,
UE::Geometry::FSphereCovering OptionalSphereCoveringOut = nullptr 
)
static

◆ RemoveConvexHulls()

void FGeometryCollectionConvexUtility::RemoveConvexHulls ( FManagedArrayCollection GeometryCollection,
const TArray< int32 > &  TransformsToClearHullsFrom 
)
static

Delete the convex hulls pointed at by the transform indices provided.

◆ RemoveEmptyConvexHulls()

void FGeometryCollectionConvexUtility::RemoveEmptyConvexHulls ( FManagedArrayCollection Collection)
static

Delete the convex hulls that are null

◆ SetDefaults()

void FGeometryCollectionConvexUtility::SetDefaults ( FGeometryCollection GeometryCollection,
FName  Group,
uint32  StartSize,
uint32  NumElements 
)
static

Set default values for convex hull related managed arrays.

◆ SetVolumeAttributes()

void FGeometryCollectionConvexUtility::SetVolumeAttributes ( FManagedArrayCollection Collection)
static

Set Volume and Size attributes on the Collection (will be called by CreateNonOverlappingConvexHullData – Volumes must be up to date for convex calc)

◆ ValidateConvexData()

bool FGeometryCollectionConvexUtility::ValidateConvexData ( const FManagedArrayCollection GeometryCollection)
static
Returns
true if the GeometryCollection has convex data with no null pointers and no invalid indices

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