UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::FColliderMesh Class Reference

#include <ColliderMesh.h>

Classes

struct  FBuildOptions
 

Public Member Functions

GEOMETRYCORE_API FColliderMesh ()
 
GEOMETRYCORE_API FColliderMesh (const FDynamicMesh3 &SourceMesh, const FBuildOptions &BuildOptions=FBuildOptions())
 
GEOMETRYCORE_API void Initialize (const FDynamicMesh3 &SourceMesh, const FBuildOptions &BuildOptions=FBuildOptions())
 
GEOMETRYCORE_API void Reset (EAllowShrinking AllowShrinking)
 
FORCEINLINE void Reset (bool bReleaseMemory)
 
bool IsTriangle (int32 TriangleID) const
 
bool IsVertex (int32 VertexID) const
 
int32 MaxTriangleID () const
 
int32 MaxVertexID () const
 
int32 TriangleCount () const
 
int32 VertexCount () const
 
uint64 GetChangeStamp () const
 
FIndex3i GetTriangle (int32 TriangleID) const
 
FVector3d GetVertex (int32 VertexID) const
 
void GetTriVertices (int32 TriangleID, FVector3d &V0, FVector3d &V1, FVector3d &V2) const
 
FVector3d GetTriNormal (int32 TriangleID) const
 
bool SourceWasCompactV () const
 
bool HasVertexIDMap () const
 
GEOMETRYCORE_API int32 GetSourceVertexID (int32 VertexID) const
 
bool SourceWasCompactT () const
 
bool HasTriangleIDMap () const
 
GEOMETRYCORE_API int32 GetSourceTriangleID (int32 TriangleID) const
 
GEOMETRYCORE_API bool FindNearestHitTriangle (const FRay3d &Ray, double &RayParameterOut, int &HitTriangleIDOut, FVector3d &BaryCoordsOut, const IMeshSpatial::FQueryOptions &Options=IMeshSpatial::FQueryOptions()) const
 
GEOMETRYCORE_API int FindNearestTriangle (const FVector3d &Point, double &NearestDistSqrOut, const IMeshSpatial::FQueryOptions &Options=IMeshSpatial::FQueryOptions()) const
 
GEOMETRYCORE_API TMeshAABBTree3< FColliderMesh > * GetRawAABBTreeUnsafe ()
 

Protected Attributes

TArray< FVector3dVertices
 
TArray< FIndex3iTriangles
 
TArray< int32SourceVertexIDs
 
bool bSourceWasCompactV
 
TArray< int32SourceTriangleIDs
 
bool bSourceWasCompactT
 
TMeshAABBTree3< FColliderMeshAABBTree
 

Detailed Description

FColliderMesh is a minimal representation of an Indexed Triangle Mesh suitable to use with a TMeshAABBTree3. This class is intended to be used in situations where a copy of a FDynamicMesh3 would be created/kept only to use with an AABBTree or FWNTree. In such situations, the FDynamicMesh3 copy is (relatively) heavy memory-wise, particularly if a large number of small mesh/AABBTree pairs are stored. In those cases a FColliderMesh can be used instead.

If FBuildOptions.bBuildAABBTree is true (default), then an AABBTree will automatically be built and available via GetAABBTree()

If the source FDynamicMesh3 is not compact, it will be compacted. ID mappings can optionally be stored if the FBuildOptions are configured to request it (default false), allowing hit-triangle/vertex IDs to be mapped back to IDs on the source mesh.

Currently there is no support for UVs or Vertex Normals.

FColliderMesh (effectively) implements the TTriangleMeshAdapter interface, and so can be used anywhere a TTriangleMeshAdapter could be used (eg with TMeshQueries functions).

Constructor & Destructor Documentation

◆ FColliderMesh() [1/2]

FColliderMesh::FColliderMesh ( )

◆ FColliderMesh() [2/2]

FColliderMesh::FColliderMesh ( const FDynamicMesh3 SourceMesh,
const FBuildOptions BuildOptions = FBuildOptions() 
)

Member Function Documentation

◆ FindNearestHitTriangle()

bool FColliderMesh::FindNearestHitTriangle ( const FRay3d Ray,
double RayParameterOut,
int &  HitTriangleIDOut,
FVector3d BaryCoordsOut,
const IMeshSpatial::FQueryOptions Options = IMeshSpatial::FQueryOptions() 
) const
Parameters
HitTriangleIDOutTriangleID on collider mesh - use GetSourceTriangleID() to map back to source mesh
Returns
true if a triangle was hit and Out parameters are initialized

◆ FindNearestTriangle()

int FColliderMesh::FindNearestTriangle ( const FVector3d Point,
double NearestDistSqrOut,
const IMeshSpatial::FQueryOptions Options = IMeshSpatial::FQueryOptions() 
) const

Find the TriangleID closest to P on the collider mesh, and distance to it, within distance MaxDist, or return InvalidID. Use GetSourceTriangleID() to map the TriangleID back to the source mesh. Use MeshQueries.TriangleDistance() to get more information.

◆ GetChangeStamp()

uint64 UE::Geometry::FColliderMesh::GetChangeStamp ( ) const
inline

◆ GetRawAABBTreeUnsafe()

TMeshAABBTree3< FColliderMesh > * FColliderMesh::GetRawAABBTreeUnsafe ( )

Direct access to the AABBTree pointer inside the ColliderMesh.

Warning
this function should be avoided if possible, and may be removed in the future.

◆ GetSourceTriangleID()

int32 FColliderMesh::GetSourceTriangleID ( int32  TriangleID) const

◆ GetSourceVertexID()

int32 FColliderMesh::GetSourceVertexID ( int32  VertexID) const

◆ GetTriangle()

FIndex3i UE::Geometry::FColliderMesh::GetTriangle ( int32  TriangleID) const
inline

◆ GetTriNormal()

FVector3d UE::Geometry::FColliderMesh::GetTriNormal ( int32  TriangleID) const
inline

◆ GetTriVertices()

void UE::Geometry::FColliderMesh::GetTriVertices ( int32  TriangleID,
FVector3d V0,
FVector3d V1,
FVector3d V2 
) const
inline

◆ GetVertex()

FVector3d UE::Geometry::FColliderMesh::GetVertex ( int32  VertexID) const
inline

◆ HasTriangleIDMap()

bool UE::Geometry::FColliderMesh::HasTriangleIDMap ( ) const
inline

◆ HasVertexIDMap()

bool UE::Geometry::FColliderMesh::HasVertexIDMap ( ) const
inline

◆ Initialize()

void FColliderMesh::Initialize ( const FDynamicMesh3 SourceMesh,
const FBuildOptions BuildOptions = FBuildOptions() 
)

◆ IsTriangle()

bool UE::Geometry::FColliderMesh::IsTriangle ( int32  TriangleID) const
inline

◆ IsVertex()

bool UE::Geometry::FColliderMesh::IsVertex ( int32  VertexID) const
inline

◆ MaxTriangleID()

int32 UE::Geometry::FColliderMesh::MaxTriangleID ( ) const
inline

◆ MaxVertexID()

int32 UE::Geometry::FColliderMesh::MaxVertexID ( ) const
inline

◆ Reset() [1/2]

FORCEINLINE void UE::Geometry::FColliderMesh::Reset ( bool  bReleaseMemory)
inline

◆ Reset() [2/2]

void FColliderMesh::Reset ( EAllowShrinking  AllowShrinking)

◆ SourceWasCompactT()

bool UE::Geometry::FColliderMesh::SourceWasCompactT ( ) const
inline

◆ SourceWasCompactV()

bool UE::Geometry::FColliderMesh::SourceWasCompactV ( ) const
inline

◆ TriangleCount()

int32 UE::Geometry::FColliderMesh::TriangleCount ( ) const
inline

◆ VertexCount()

int32 UE::Geometry::FColliderMesh::VertexCount ( ) const
inline

Member Data Documentation

◆ AABBTree

TMeshAABBTree3<FColliderMesh> UE::Geometry::FColliderMesh::AABBTree
protected

◆ bSourceWasCompactT

bool UE::Geometry::FColliderMesh::bSourceWasCompactT
protected

◆ bSourceWasCompactV

bool UE::Geometry::FColliderMesh::bSourceWasCompactV
protected

◆ SourceTriangleIDs

TArray<int32> UE::Geometry::FColliderMesh::SourceTriangleIDs
protected

◆ SourceVertexIDs

TArray<int32> UE::Geometry::FColliderMesh::SourceVertexIDs
protected

◆ Triangles

TArray<FIndex3i> UE::Geometry::FColliderMesh::Triangles
protected

◆ Vertices

TArray<FVector3d> UE::Geometry::FColliderMesh::Vertices
protected

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