UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ShapeComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
9#include "ShapeComponent.generated.h"
10
14
15namespace physx
16{
17 class PxShape;
18}
19
23UCLASS(abstract, hidecategories=(Object,LOD,Lighting,TextureStreaming,Activation,"Components|Activation"), editinlinenew, meta=(BlueprintSpawnableComponent), showcategories=(Mobility), MinimalAPI)
24class UShapeComponent : public UPrimitiveComponent
25{
27
28
31
32#if WITH_EDITORONLY_DATA
37 UE_DEPRECATED(5.0, "AreaClass is deprecated, use AreaClassOverride / bUseSystemDefaultObstacleAreaClass instead!.")
38 UPROPERTY()
39 TSubclassOf<class UNavAreaBase> AreaClass;
40#endif // WITH_EDITORONLY_DATA
41
43 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, Category=Shape)
45
47 UPROPERTY()
49
51 UPROPERTY()
53
55 UPROPERTY(EditAnywhere, Category = Navigation)
57
60 UPROPERTY(EditAnywhere, Category = Navigation, meta = (EditCondition = "bDynamicObstacle"))
62
65
69 UPROPERTY(EditAnywhere, Category = Navigation, meta = (EditCondition = "bDynamicObstacle && !bUseSystemDefaultObstacleAreaClass"))
71
73 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Shape)
74 float LineThickness;
75
77 template<typename ComponentType>
79 {
81 if (bUseArchetypeBodySetup && ShapeBodySetup == nullptr)
82 {
83 ShapeBodySetup = CastChecked<ComponentType>(GetArchetype())->GetBodySetup();
84 bSuccess = ShapeBodySetup != nullptr;
85 }
86
87 return bSuccess;
88 }
89
90 template <typename ShapeElemType> void AddShapeToGeomArray();
91 template <typename ShapeElemType> void SetShapeToNewGeom(const FPhysicsShapeHandle& Shape);
92 template <typename ShapeElemType> void CreateShapeBodySetupIfNeeded();
93
94public:
95 // Set the LineThickness
96 UFUNCTION(BlueprintCallable, Category=Shape)
97 ENGINE_API void SetLineThickness(float Thickness);
98
99 //~ Begin UPrimitiveComponent Interface.
100 ENGINE_API virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
101 ENGINE_API virtual class UBodySetup* GetBodySetup() override;
102 ENGINE_API virtual bool DoCustomNavigableGeometryExport(FNavigableGeometryExport& GeomExport) const override;
103 ENGINE_API virtual void GetNavigationData(FNavigationRelevantData& Data) const override;
104 //~ End UPrimitiveComponent Interface.
105
106 //~ Begin INavRelevantInterface Interface
107 ENGINE_API virtual bool IsNavigationRelevant() const override;
108 //~ End INavRelevantInterface Interface
109
110 //~ Begin USceneComponent Interface
111 ENGINE_API virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
112 virtual bool ShouldCollideWhenPlacing() const override
113 {
114 return bShouldCollideWhenPlacing || IsCollisionEnabled();
115 }
116 //~ End USceneComponent Interface
117
118 //~ Begin UObject Interface.
119 ENGINE_API virtual void Serialize(FArchive& Ar) override;
120 virtual bool GetIgnoreBoundsForEditorFocus() const override { return true; }
121#if WITH_EDITORONLY_DATA
123#endif
124
125#if WITH_EDITOR
126 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
127#endif // WITH_EDITOR
128 //~ End UObject Interface.
129
131 ENGINE_API virtual void UpdateBodySetup();
132
136};
137
bool bSuccess
Definition ConvexDecomposition3.cpp:819
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
EShapeBodySetupHelper
Definition ShapeComponent.h:139
@ UpdateBodySetup
Definition BoxComponent.cpp:94
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition ChaosEngineInterface.h:263
Definition PrimitiveSceneProxy.h:296
Definition Array.h:670
Definition SubclassOf.h:30
Definition BodySetup.h:128
Definition Class.h:3793
Definition NavAreaBase.h:14
ENGINE_API FBox CalcBounds(const FVector &P0, const FVector &P1, const FVector &P2, const FVector &P3)
Definition BezierUtilities.cpp:26
Definition ShapeComponent.h:16
Definition Color.h:486
Definition NavigationSystemHelpers.h:25
Definition NavigationRelevantData.h:40
Definition UnrealType.h:6865
Definition ObjectPtr.h:488
Definition BoxSphereBounds.h:25