RapyutaSimulationPlugins
RRProceduralMeshComponent.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 
18 
19 // UE
20 
21 #include "ProceduralMeshComponent.h"
22 
23 
24 
25 // RapyutaSimulationPlugins
26 
27 #include "Core/RRActorCommon.h"
28 
29 #include "Core/RRGameSingleton.h"
30 
31 #include "Core/RRMeshData.h"
32 
33 #include "Core/RRUObjectUtils.h"
34 
35 
36 
37 #include "RRProceduralMeshComponent.generated.h"
38 
39 
40 
54 class RAPYUTASIMULATIONPLUGINS_API URRProceduralMeshComponent : public UProceduralMeshComponent
55 
56 {
57 
58 
59 
60 public:
61 
78  URRProceduralMeshComponent(const FObjectInitializer& ObjectInitializer);
79 
80 
81 
82 
87  FString MeshUniqueName;
88 
89 
90 
91  FString GetBodySetupModelName() const
92 
93  {
94 
96 
97  MeshUniqueName);
98 
99  }
100 
101 
102 
103 
109 
110 
111 
124  void Initialize(bool bIsStaticBody, bool bInIsPhysicsEnabled);
125 
126 
127 
144  bool InitializeMesh(const FString& InMeshFileName);
145 
146 
147 
148  FOnMeshCreationDone OnMeshCreationDone;
149 
150 
151 
152 
157  FTransform OriginRelativeTransform = FTransform::Identity;
158 
159 
160 
161 
166  bool bIsStationary = false;
167 
168 
169 
180  void SetMeshSize(const FVector& InSize);
181 
182 
183 
184  FVector GetSize() const
185 
186  {
187 
188  // TBD
189 
190  return FVector::ZeroVector;
191 
192  }
193 
194 
195 
196  FVector GetExtent() const
197 
198  {
199 
200  return 0.5f * GetSize();
201 
202  }
203 
204 
205 
206  void LockSelf()
207 
208  {
209 
210  }
211 
212 
213 
214  void HideSelf(bool IsHidden)
215 
216  {
217 
218  }
219 
220 
221 
222  // Collision/Overlapping --
223 
224  void SetCollisionModeAvailable(bool bIsOn, bool bIsHitEventEnabled = false);
225 
226  void EnableOverlapping(bool bOverlapEventEnabled);
227 
228 
229 
230  bool IsMeshDataValid() const;
231 
232  bool GetMeshData(FRRMeshData& OutMeshData, bool bFromBuffer);
233 
234  void GetLocalBounds(FVector& OutMinBounds, FVector& OutMaxBounds)
235 
236  {
237 
238  }
239 
240 
241 
242 protected:
243 
244  virtual bool ShouldCreatePhysicsState() const override
245 
246  {
247 
248  return true;
249 
250  }
251 
252 
253 
254 private:
255 
256 
262 
263 
268  FTimerHandle BodySetupTimerHandle;
269 
270 
271 
286  bool CreateMeshBody(const FRRMeshData& InMeshData);
287 
288 
289 
290  void CreateMeshSection(const TArray<FRRMeshNodeData>& InMeshSectionData);
291 
292 
293 
294  void FinalizeMeshBodyCreation(UBodySetup* InBodySetup, const FString& InBodySetupModelName);
295 
296 };
297 
URRUObjectUtils::ComposeDynamicResourceName
static FORCEINLINE FString ComposeDynamicResourceName(const FString &InPrefix, const FString &InResourceUniqueName)
Definition: RRUObjectUtils.h:204
ERRResourceDataType::UE_BODY_SETUP
@ UE_BODY_SETUP
ERRShapeType::NONE
@ NONE
URRProceduralMeshComponent::GetBodySetupModelName
FString GetBodySetupModelName() const
Definition: RRProceduralMeshComponent.h:91
RRGameSingleton.h
GameSingleton.
URRProceduralMeshComponent::ShouldCreatePhysicsState
virtual bool ShouldCreatePhysicsState() const override
Definition: RRProceduralMeshComponent.h:244
URRProceduralMeshComponent::MeshUniqueName
FString MeshUniqueName
Definition: RRProceduralMeshComponent.h:87
URRProceduralMeshComponent::CollisionCookingTimerHandle
FTimerHandle CollisionCookingTimerHandle
Definition: RRProceduralMeshComponent.h:261
URRProceduralMeshComponent::BodySetupTimerHandle
FTimerHandle BodySetupTimerHandle
Definition: RRProceduralMeshComponent.h:268
RRUObjectUtils.h
UObject general utils.
URRProceduralMeshComponent
Procedural mesh components. this class is used to spawn robot and object from ROS 2 service.
Definition: RRProceduralMeshComponent.h:54
URRGameSingleton::GetAssetNamePrefix
static constexpr const FORCEINLINE TCHAR * GetAssetNamePrefix(const ERRResourceDataType InDataType)
Get name prefix of asset.
Definition: RRGameSingleton.h:328
URRProceduralMeshComponent::GetLocalBounds
void GetLocalBounds(FVector &OutMinBounds, FVector &OutMaxBounds)
Definition: RRProceduralMeshComponent.h:234
ERRShapeType
ERRShapeType
Shape types.
Definition: RRObjectCommon.h:137
URRProceduralMeshComponent::HideSelf
void HideSelf(bool IsHidden)
Definition: RRProceduralMeshComponent.h:214
FRRMeshData
todo
Definition: RRMeshData.h:523
URRProceduralMeshComponent::OnMeshCreationDone
FOnMeshCreationDone OnMeshCreationDone
Definition: RRProceduralMeshComponent.h:148
URRProceduralMeshComponent::LockSelf
void LockSelf()
Definition: RRProceduralMeshComponent.h:206
RRActorCommon.h
Asset utils.
URRProceduralMeshComponent::GetSize
FVector GetSize() const
Definition: RRProceduralMeshComponent.h:184
RRMeshData.h
MeshData.
URRProceduralMeshComponent::GetExtent
FVector GetExtent() const
Definition: RRProceduralMeshComponent.h:196