UCapsuleComponent

A capsule generally used for simple collision. Bounds are rendered as lines in the editor.

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Components/CapsuleComponent.h

Include

#include "Components/CapsuleComponent.h"

Syntax

class UCapsuleComponent : public UShapeComponent

Remarks

A capsule generally used for simple collision. Bounds are rendered as lines in the editor.

Variables

Name Description

Protected variable

float

 

CapsuleHalfHeight

Half-height, from center of capsule to the end of top or bottom hemisphere.

Protected variable

float

 

CapsuleRadius

Radius of cap hemispheres and center cylinder. This cannot be more than CapsuleHalfHeight.

Constructors

Name Description

Public function

UCapsuleComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Const

float

 

GetScaledCapsuleHalfHeight()

Returns the capsule half-height scaled by the component scale.

Public function Const

float

 

GetScaledCapsuleHalfHeight_WithoutHemisphere()

Returns the capsule half-height minus radius (to exclude the hemisphere), scaled by the component scale.

Public function Const

float

 

GetScaledCapsuleRadius()

Returns the capsule radius scaled by the component scale.

Public function Const

void

 

GetScaledCapsuleSize

(
    float& OutRadius,
    float& OutHalfHeight
)

Returns the capsule radius and half-height scaled by the component scale.

Public function Const

void

 

GetScaledCapsuleSize_WithoutHemisphere

(
    float& OutRadius,
    float& OutHalfHeightWithoutHemisph...
)

Returns the capsule radius and half-height scaled by the component scale.

Public function Const

float

 

GetShapeScale()

Get the scale used by this shape.

Public function Const

float

 

GetUnscaledCapsuleHalfHeight()

Returns the capsule half-height, ignoring component scaling. This includes the hemisphere end cap.

Public function Const

float

 

GetUnscaledCapsuleHalfHeight_WithoutHemisphere()

Returns the capsule half-height minus radius (to exclude the hemisphere), ignoring component scaling.

Public function Const

float

 

GetUnscaledCapsuleRadius()

Returns the capsule radius, ignoring component scaling.

Public function Const

void

 

GetUnscaledCapsuleSize

(
    float& OutRadius,
    float& OutHalfHeight
)

Returns the capsule radius and half-height scaled by the component scale.

Public function Const

void

 

GetUnscaledCapsuleSize_WithoutHemisphere

(
    float& OutRadius,
    float& OutHalfHeightWithoutHemisph...
)

Returns the capsule radius and half-height, ignoring component scaling.

Public function

void

 

InitCapsuleSize

(
    float InRadius,
    float InHalfHeight
)

Sets the capsule size without triggering a render or physics update. This is the preferred method when initializing a component in a class constructor.

Public function

void

 

SetCapsuleHalfHeight

(
    float HalfHeight,
    bool bUpdateOverlaps
)

Set the capsule half-height.

Public function

void

 

SetCapsuleRadius

(
    float Radius,
    bool bUpdateOverlaps
)

Set the capsule radius.

Public function

void

 

SetCapsuleSize

(
    float InRadius,
    float InHalfHeight,
    bool bUpdateOverlaps
)

Change the capsule size. This is the unscaled size, before component scale is applied.

Overridden from UShapeComponent

Name Description

Public function Virtual

void

 

UpdateBodySetup()

Update the body setup parameters based on shape information

Overridden from UPrimitiveComponent

Name Description

Public function Virtual Const

bool

 

AreSymmetricRotations

(
    const FQuat& A,
    const FQuat& B,
    const FVector& Scale3D
)

Returns true if the given transforms result in the same bounds, due to rotational symmetry.

Public function Virtual

FPrimitiveSc...

 

CreateSceneProxy()

Creates a proxy to represent the primitive to the scene manager in the rendering thread.

Public function Virtual Const

FCollisionSh...

 

GetCollisionShape

(
    float Inflation
)

Return a CollisionShape that most closely matches this primitive.

Public function Virtual Const

bool

 

IsZeroExtent()

This isn't bound extent, but for shape component to utilize extent is 0.

Overridden from USceneComponent

Name Description

Public function Virtual Const

void

 

CalcBoundingCylinder

(
    float& CylinderRadius,
    float& CylinderHalfHeight
)

Calculate the axis-aligned bounding cylinder of the component (radius in X-Y, half-height along Z axis).

Public function Virtual Const

FBoxSphereBo...

 

CalcBounds

(
    const FTransform& LocalToWorld
)

Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size.

Overridden from UObject

Name Description

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Deprecated Variables

Name Description

Protected variable

float

 

CapsuleHeight_DEPRECATED

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Cancel