Useful if you want to extract the authored collision information to use in other system. Perhaps ones that rely on SDFs; Like a 3d fluid simulation.
#include "PhysicsEngine/BodySetup.h"
void GetMeshCollision(const UStaticMeshComponent* Component)
{
// Get to the Mesh Geometry
const UStaticMesh* Mesh = Component->GetStaticMesh();
const UBodySetup* MeshBodySetup = Mesh->GetBodySetup();
const FKAggregateGeom& MeshGeometry = MeshBodySetup->AggGeom;
// Access to the collision primitive definitions.
const TArray<FKBoxElem>& Boxes = MeshGeometry.BoxElems;
const TArray<FKSphereElem>& Spheres = MeshGeometry.SphereElems;
const TArray<FKSphylElem>& Capsules = MeshGeometry.SphylElems;
const TArray<FKTaperedCapsuleElem>& TaperedCapsules = MeshGeometry.TaperedCapsuleElems;
const TArray<FKConvexElem>& ConvexShapes = MeshGeometry.ConvexElems;
const TArray<FKLevelSetElem>& LevelSets = MeshGeometry.LevelSetElems;
const TArray<FKSkinnedLevelSetElem>& SkinnedLevelSets = MeshGeometry.SkinnedLevelSetElems;
}