Navigation
API > API/Runtime > API/Runtime/Engine
A capsule generally used for simple collision. Bounds are rendered as lines in the editor.
| Name | UCapsuleComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/Components/CapsuleComponent.h |
| Include Path | #include "Components/CapsuleComponent.h" |
Syntax
UCLASS (ClassGroup="Collision", EditInlineNew,
HideCategories=(Object, LOD, Lighting, TextureStreaming),
Meta=(DisplayName="Capsule Collision", BlueprintSpawnableComponent), MinimalAPI)
class UCapsuleComponent : public UShapeComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UPrimitiveComponent → UShapeComponent → UCapsuleComponent
Implements Interfaces
- IAsyncPhysicsStateProcessor
- IInterface_AssetUserData
- IInterface_AsyncCompilation
- INavRelevantInterface
- IPhysicsComponent
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UCapsuleComponent
(
const FObjectInitializer& ObjectInitializer |
Components/CapsuleComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
float GetScaledCapsuleHalfHeight () |
Returns the capsule half-height scaled by the component scale. | Components/CapsuleComponent.h |
|
| Returns the capsule half-height minus radius (to exclude the hemisphere), scaled by the component scale. | Components/CapsuleComponent.h |
|
|
float GetScaledCapsuleRadius() |
Returns the capsule radius scaled by the component scale. | Components/CapsuleComponent.h |
|
void GetScaledCapsuleSize
(
float& OutRadius, |
Returns the capsule radius and half-height scaled by the component scale. | Components/CapsuleComponent.h |
|
void GetScaledCapsuleSize_WithoutHemisphere
(
float& OutRadius, |
Returns the capsule radius and half-height scaled by the component scale. | Components/CapsuleComponent.h |
|
float GetShapeScale () |
Get the scale used by this shape. | Components/CapsuleComponent.h |
|
float GetUnscaledCapsuleHalfHeight() |
Returns the capsule half-height, ignoring component scaling. This includes the hemisphere end cap. | Components/CapsuleComponent.h |
|
| Returns the capsule half-height minus radius (to exclude the hemisphere), ignoring component scaling. | Components/CapsuleComponent.h |
|
|
float GetUnscaledCapsuleRadius() |
Returns the capsule radius, ignoring component scaling. | Components/CapsuleComponent.h |
|
void GetUnscaledCapsuleSize
(
float& OutRadius, |
Returns the capsule radius and half-height scaled by the component scale. | Components/CapsuleComponent.h |
|
void GetUnscaledCapsuleSize_WithoutHemisphere
(
float& OutRadius, |
Returns the capsule radius and half-height, ignoring component scaling. | Components/CapsuleComponent.h |
|
void InitCapsuleSize
(
float InRadius, |
Sets the capsule size without triggering a render or physics update. This is the preferred method when initializing a component in a class constructor. | Components/CapsuleComponent.h | |
void SetCapsuleHalfHeight
(
float HalfHeight, |
Set the capsule half-height. | Components/CapsuleComponent.h |
|
void SetCapsuleRadius
(
float Radius, |
Set the capsule radius. | Components/CapsuleComponent.h |
|
void SetCapsuleSize
(
float InRadius, |
Change the capsule size. This is the unscaled size, before component scale is applied. | Components/CapsuleComponent.h |
|
Overridden from UShapeComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void UpdateBodySetup() |
Update the body setup parameters based on shape information | Components/CapsuleComponent.h |
Overridden from UPrimitiveComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool AreSymmetricRotations
(
const FQuat& A, |
Returns true if the given transforms result in the same bounds, due to rotational symmetry. | Components/CapsuleComponent.h | |
virtual FPrimitiveSceneProxy * CreateSceneProxy() |
Creates a proxy to represent the primitive to the scene manager in the rendering thread. | Components/CapsuleComponent.h | |
virtual FCollisionShape GetCollisionShape
(
float Inflation |
Return a CollisionShape that most closely matches this primitive. | Components/CapsuleComponent.h | |
virtual bool IsZeroExtent () |
This isn't bound extent, but for shape component to utilize extent is 0. | Components/CapsuleComponent.h |
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CalcBoundingCylinder
(
float& CylinderRadius, |
Calculate the axis-aligned bounding cylinder of the component (radius in X-Y, half-height along Z axis). | Components/CapsuleComponent.h | |
virtual FBoxSphereBounds CalcBounds
(
const FTransform& LocalToWorld |
Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size. | Components/CapsuleComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Components/CapsuleComponent.h | ||
virtual void PostLoad() |
Components/CapsuleComponent.h | ||
virtual void Serialize
(
FArchive& Ar |
Components/CapsuleComponent.h |
Deprecated Variables
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CapsuleHeight_DEPRECATED | float | Components/CapsuleComponent.h |