UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ShapeElem.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"
7#include "EngineDefines.h"
8#include "PhysxUserData.h"
10#include "Engine/EngineTypes.h"
11#include "ShapeElem.generated.h"
12
13UENUM()
14namespace EAggCollisionShape
15{
30}
31
33USTRUCT()
35{
37
39 : RestOffset(0.f)
40#if WITH_EDITORONLY_DATA
41 , bIsGenerated(false)
42#endif
44 , bContributeToMass(true)
45 , CollisionEnabled(ECollisionEnabled::QueryAndPhysics)
46 , UserData(this)
47 {}
48
50 : RestOffset(0.f)
52 , bIsGenerated(false)
53#endif
54 , ShapeType(InShapeType)
55 , bContributeToMass(true)
57 , UserData(this)
58 {}
59
61 : RestOffset(Copy.RestOffset)
63 , bIsGenerated(Copy.bIsGenerated)
64#endif
65 , Name(Copy.Name)
66 , ShapeType(Copy.ShapeType)
67 , bContributeToMass(Copy.bContributeToMass)
69 , UserData(this)
70 {
71 }
72
74
76 {
77 CloneElem(Other);
78 return *this;
79 }
80
81 template <typename T>
83 {
84 check(T::StaticShapeType == ShapeType);
85 return (T*)this;
86 }
87
88 const FUserData* GetUserData() const { FUserData::Set<FKShapeElem>((void*)&UserData, const_cast<FKShapeElem*>(this)); return &UserData; }
89
91
93 const FName& GetName() const { return Name; }
94
96 void SetName(const FName& InName) { Name = InName; }
97
99 EAggCollisionShape::Type GetShapeType() const { return ShapeType; }
100
102 bool GetContributeToMass() const { return bContributeToMass; }
103
106
109
112
113 virtual FTransform GetTransform() const
114 {
115 return FTransform();
116 }
117
118 virtual void DrawElemWire(class FPrimitiveDrawInterface* PDI, const FTransform& ElemTM, const float Scale, const FColor Color) const {}
119 virtual void DrawElemSolid(class FPrimitiveDrawInterface* PDI, const FTransform& ElemTM, const float Scale, const class FMaterialRenderProxy* MaterialRenderProxy) const {}
120
124 UPROPERTY(Category = Shape, EditAnywhere)
125 float RestOffset;
126
127#if WITH_EDITORONLY_DATA
129 UPROPERTY(Category = Shape, EditAnywhere, DisplayName="Collision Generated")
130 uint8 bIsGenerated : 1;
131#endif
132
133protected:
136 {
137 RestOffset = Other.RestOffset;
138 ShapeType = Other.ShapeType;
139 Name = Other.Name;
140 bContributeToMass = Other.bContributeToMass;
141 CollisionEnabled = Other.CollisionEnabled;
142#if WITH_EDITORONLY_DATA
143 bIsGenerated = Other.bIsGenerated;
144#endif
145 }
146
147private:
149 UPROPERTY(Category=Shape, EditAnywhere)
150 FName Name;
151
152 EAggCollisionShape::Type ShapeType;
153
157 UPROPERTY(Category=Shape, EditAnywhere)
158 uint8 bContributeToMass : 1;
159
162 UPROPERTY(Category=Shape, EditAnywhere)
164
165 FUserData UserData;
166};
#define check(expr)
Definition AssertionMacros.h:314
#define WITH_EDITORONLY_DATA
Definition CoreMiscDefines.h:24
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
UE::Math::TTransform< double > FTransform
Definition MathFwd.h:53
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
if(Failed) console_printf("Failed.\n")
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition MaterialRenderProxy.h:102
Definition NameTypes.h:617
Definition PrimitiveDrawInterface.h:19
Definition EnumAsByte.h:22
Definition PhysicsAsset.h:13
Type
Definition ShapeElem.h:17
@ LevelSet
Definition ShapeElem.h:23
@ Unknown
Definition ShapeElem.h:28
@ SkinnedTriangleMesh
Definition ShapeElem.h:26
@ SkinnedLevelSet
Definition ShapeElem.h:24
@ Sphyl
Definition ShapeElem.h:20
@ TaperedCapsule
Definition ShapeElem.h:22
@ MLLevelSet
Definition ShapeElem.h:25
Definition EngineTypes.h:1571
Type
Definition EngineTypes.h:1573
@ false
Definition radaudio_common.h:23
Definition PhysicsInterfaceTypesCore.h:199
Definition Color.h:486
Definition ShapeElem.h:35
virtual ENGINE_API ~FKShapeElem()
virtual void DrawElemWire(class FPrimitiveDrawInterface *PDI, const FTransform &ElemTM, const float Scale, const FColor Color) const
Definition ShapeElem.h:118
virtual FTransform GetTransform() const
Definition ShapeElem.h:113
FKShapeElem(const FKShapeElem &Copy)
Definition ShapeElem.h:60
void SetContributeToMass(bool bInContributeToMass)
Definition ShapeElem.h:105
EAggCollisionShape::Type GetShapeType() const
Definition ShapeElem.h:99
FKShapeElem(EAggCollisionShape::Type InShapeType)
Definition ShapeElem.h:49
void SetName(const FName &InName)
Definition ShapeElem.h:96
bool GetContributeToMass() const
Definition ShapeElem.h:102
T * GetShapeCheck()
Definition ShapeElem.h:82
virtual void DrawElemSolid(class FPrimitiveDrawInterface *PDI, const FTransform &ElemTM, const float Scale, const class FMaterialRenderProxy *MaterialRenderProxy) const
Definition ShapeElem.h:119
ECollisionEnabled::Type GetCollisionEnabled() const
Definition ShapeElem.h:111
void SetCollisionEnabled(ECollisionEnabled::Type InCollisionEnabled)
Definition ShapeElem.h:108
const FName & GetName() const
Definition ShapeElem.h:93
void CloneElem(const FKShapeElem &Other)
Definition ShapeElem.h:135
static ENGINE_API EAggCollisionShape::Type StaticShapeType
Definition ShapeElem.h:90
const FKShapeElem & operator=(const FKShapeElem &Other)
Definition ShapeElem.h:75
const FUserData * GetUserData() const
Definition ShapeElem.h:88