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

#include <CollisionShape.h>

Public Member Functions

 FCollisionShape ()
 
bool IsLine () const
 
bool IsBox () const
 
bool IsSphere () const
 
bool IsCapsule () const
 
void SetBox (const FVector3f &HalfExtent)
 
void SetSphere (const float Radius)
 
void SetCapsule (const float Radius, const float HalfHeight)
 
void SetCapsule (const FVector3f &Extent)
 
void SetShape (const ECollisionShape::Type InShapeType, const FVector &Extent)
 
bool IsNearlyZero () const
 
FVector GetExtent () const
 
float GetCapsuleAxisHalfLength () const
 
FVector GetBox () const
 
const float GetSphereRadius () const
 
const float GetCapsuleRadius () const
 
const float GetCapsuleHalfHeight () const
 
FCollisionShape Inflate (const float Inflation) const
 
FString ToString () const
 

Static Public Member Functions

static constexpr float MinBoxExtent ()
 
static constexpr float MinSphereRadius ()
 
static constexpr float MinCapsuleRadius ()
 
static constexpr float MinCapsuleAxisHalfHeight ()
 
static FCollisionShape MakeBox (const FVector &BoxHalfExtent)
 
static FCollisionShape MakeBox (const FVector3f &BoxHalfExtent)
 
static FCollisionShape MakeSphere (const float SphereRadius)
 
static FCollisionShape MakeCapsule (const float CapsuleRadius, const float CapsuleHalfHeight)
 
static FCollisionShape MakeCapsule (const FVector &Extent)
 

Public Attributes

ECollisionShape::Type ShapeType
 
union { 
 
   struct { 
 
      float   HalfExtentX 
 
      float   HalfExtentY 
 
      float   HalfExtentZ 
 
   }   Box 
 
   struct { 
 
      float   Radius 
 
   }   Sphere 
 
   struct { 
 
      float   Radius 
 
      float   HalfHeight 
 
   }   Capsule 
 
};  
 

Static Public Attributes

static struct FCollisionShape LineShape
 

Detailed Description

Collision Shapes that supports Sphere, Capsule, Box, or Line

Constructor & Destructor Documentation

◆ FCollisionShape()

FCollisionShape::FCollisionShape ( )
inline

Member Function Documentation

◆ GetBox()

FVector FCollisionShape::GetBox ( ) const
inline

Utility function to get Box Extention

◆ GetCapsuleAxisHalfLength()

float FCollisionShape::GetCapsuleAxisHalfLength ( ) const
inline

Get distance from center of capsule to center of sphere ends

◆ GetCapsuleHalfHeight()

const float FCollisionShape::GetCapsuleHalfHeight ( ) const
inline

Utility function to get Capsule Half Height. Note: This is the full half height which includes the sphere radius

◆ GetCapsuleRadius()

const float FCollisionShape::GetCapsuleRadius ( ) const
inline

Utility function to get Capsule Radius

◆ GetExtent()

FVector FCollisionShape::GetExtent ( ) const
inline

Utility function to return Extent of the shape

◆ GetSphereRadius()

const float FCollisionShape::GetSphereRadius ( ) const
inline

Utility function to get Sphere Radius

◆ Inflate()

FCollisionShape FCollisionShape::Inflate ( const float  Inflation) const
inline

◆ IsBox()

bool FCollisionShape::IsBox ( ) const
inline

Is the shape currently a box?

◆ IsCapsule()

bool FCollisionShape::IsCapsule ( ) const
inline

Is the shape currently a capsule?

◆ IsLine()

bool FCollisionShape::IsLine ( ) const
inline

Is the shape currently a Line (Default)?

◆ IsNearlyZero()

bool FCollisionShape::IsNearlyZero ( ) const
inline

Return true if nearly zero. If so, it will back out and use line trace instead

◆ IsSphere()

bool FCollisionShape::IsSphere ( ) const
inline

Is the shape currently a sphere?

◆ MakeBox() [1/2]

static FCollisionShape FCollisionShape::MakeBox ( const FVector BoxHalfExtent)
inlinestatic

Static utility function to make a box

◆ MakeBox() [2/2]

static FCollisionShape FCollisionShape::MakeBox ( const FVector3f BoxHalfExtent)
inlinestatic

Static utility function to make a box

◆ MakeCapsule() [1/2]

static FCollisionShape FCollisionShape::MakeCapsule ( const float  CapsuleRadius,
const float  CapsuleHalfHeight 
)
inlinestatic

Static utility function to make a capsule. Note: This is the full half-height (needs to include the sphere radius)

◆ MakeCapsule() [2/2]

static FCollisionShape FCollisionShape::MakeCapsule ( const FVector Extent)
inlinestatic

Static utility function to make a capsule

◆ MakeSphere()

static FCollisionShape FCollisionShape::MakeSphere ( const float  SphereRadius)
inlinestatic

Static utility function to make a sphere

◆ MinBoxExtent()

static constexpr float FCollisionShape::MinBoxExtent ( )
inlinestaticconstexpr

◆ MinCapsuleAxisHalfHeight()

static constexpr float FCollisionShape::MinCapsuleAxisHalfHeight ( )
inlinestaticconstexpr

◆ MinCapsuleRadius()

static constexpr float FCollisionShape::MinCapsuleRadius ( )
inlinestaticconstexpr

◆ MinSphereRadius()

static constexpr float FCollisionShape::MinSphereRadius ( )
inlinestaticconstexpr

◆ SetBox()

void FCollisionShape::SetBox ( const FVector3f HalfExtent)
inline

Utility function to Set Box and dimension

◆ SetCapsule() [1/2]

void FCollisionShape::SetCapsule ( const float  Radius,
const float  HalfHeight 
)
inline

Utility function to set Capsule with Radius and Half Height. Note: This is the full half-height (needs to include the sphere radius)

◆ SetCapsule() [2/2]

void FCollisionShape::SetCapsule ( const FVector3f Extent)
inline

Utility function to set Capsule from Extent data

◆ SetShape()

void FCollisionShape::SetShape ( const ECollisionShape::Type  InShapeType,
const FVector Extent 
)
inline

Utility function to set a shape from a type and extent

◆ SetSphere()

void FCollisionShape::SetSphere ( const float  Radius)
inline

Utility function to set Sphere with Radius

◆ ToString()

FString FCollisionShape::ToString ( ) const
inline

Member Data Documentation

◆ [union]

union { ... } FCollisionShape

Union that supports up to 3 floats

◆ [struct]

struct { ... } FCollisionShape::Box

◆ [struct]

struct { ... } FCollisionShape::Capsule

◆ HalfExtentX

float FCollisionShape::HalfExtentX

◆ HalfExtentY

float FCollisionShape::HalfExtentY

◆ HalfExtentZ

float FCollisionShape::HalfExtentZ

◆ HalfHeight

float FCollisionShape::HalfHeight

◆ LineShape

FCollisionShape FCollisionShape::LineShape
static

Used by engine in multiple places. Since LineShape doesn't need any dimension, declare once and used by all codes.

◆ Radius

float FCollisionShape::Radius

◆ ShapeType

ECollisionShape::Type FCollisionShape::ShapeType

◆ [struct]

struct { ... } FCollisionShape::Sphere

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