UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GeometryParticles.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
9#include "Chaos/Box.h"
15#include "Chaos/Properties.h"
18#include "Chaos/ShapeInstance.h"
19
20#ifndef CHAOS_DETERMINISTIC
21#define CHAOS_DETERMINISTIC 1
22#endif
23
24
25namespace Chaos
26{
27 class FConstraintHandle;
28 class FParticleCollisions;
29
31
32 namespace CVars
33 {
36 }
37
38 namespace Private
39 {
40 class FPBDIslandParticle;
41
42 CHAOS_API extern FString EmptyParticleName;
43 }
44
50 {
51 public:
52
53 // Store particle's shape array if particle has union geometry, otherwise individual shape.
55
57 : Shape(nullptr)
58 , bIsSingleShape(true)
59 {}
60
62 : Shape(InShape)
63 , bIsSingleShape(true)
64 {}
65
70
71 bool IsSingleShape() const { return bIsSingleShape; }
72
73 bool IsValid() const { return Shape != nullptr; }
74
75 // Do not call without checking IsSingleShape().
76 const FPerShapeData* GetShape() const
77 {
78 check(bIsSingleShape);
79 return Shape;
80 }
81
82 // Do not call without checking IsSingleShape().
84 {
85 check(!bIsSingleShape);
86 return ShapeArray;
87 }
88
89 private:
90 union
91 {
94 };
95
96 bool bIsSingleShape;
97 };
98
100 {
101 return ::GetTypeHash(Unique.GlobalID);
102 }
103
104 //Holds the data for getting back at the real handle if it's still valid
105 //Systems should not use this unless clean-up of direct handle is slow, this uses thread safe shared ptr which is not cheap
107 {
108 public:
109
112
113 //Assumes the weak particle handle has been initialized so SharedData must exist
115 {
116 return SharedData->Handle;
117 }
118
119 TGeometryParticleHandle<FReal,3>* GetHandle() const { return SharedData ? SharedData->Handle : nullptr; }
121 {
122 if(SharedData)
123 {
124 SharedData->Handle = nullptr;
125 }
126 }
127
129 {
130 return SharedData != nullptr;
131 }
132
133 private:
134
135 struct FData
136 {
138 };
140 };
141
142 enum class EResimType : uint8
143 {
144 FullResim = 0, //fully re-run simulation and keep results (any forces must be applied again)
145 //ResimWithPrevForces, //use previous forces and keep results (UNIMPLEMENTED)
146 ResimAsFollower = 1 //use previous forces and snap to previous results regardless of variation - used to push other objects away
147 //ResimAsKinematic //treat as kinematic (UNIMPLEMENTED)
148 };
149
150 template<class T, int d, EGeometryParticlesSimType SimType>
152 {
153 public:
154
156 using TParticles<T,d>::GetX;
161
163
175 , MUniqueIdx(MoveTemp(Other.MUniqueIdx))
176 , MGeometryParticleHandle(MoveTemp(Other.MGeometryParticleHandle))
177 , MGeometryParticle(MoveTemp(Other.MGeometryParticle))
178 , MPhysicsProxy(MoveTemp(Other.MPhysicsProxy))
179 , MHasCollision(MoveTemp(Other.MHasCollision))
180 , MShapesArray(MoveTemp(Other.MShapesArray))
181 , MLocalBounds(MoveTemp(Other.MLocalBounds))
182 , MCCDAxisThreshold(MoveTemp(Other.MCCDAxisThreshold))
183 , MWorldSpaceInflatedBounds(MoveTemp(Other.MWorldSpaceInflatedBounds))
184 , MHasBounds(MoveTemp(Other.MHasBounds))
185 , MSpatialIdx(MoveTemp(Other.MSpatialIdx))
186 , MSyncState(MoveTemp(Other.MSyncState))
187 , MWeakParticleHandle(MoveTemp(Other.MWeakParticleHandle))
188 , MParticleConstraints(MoveTemp(Other.MParticleConstraints))
189 , MParticleCollisions(MoveTemp(Other.MParticleCollisions))
190 , MGraphNode(MoveTemp(Other.MGraphNode))
191 , MResimType(MoveTemp(Other.MResimType))
192 , MEnabledDuringResim(MoveTemp(Other.MEnabledDuringResim))
193 , MLightWeightDisabled(MoveTemp(Other.MLightWeightDisabled))
195 , MParticleIDs(MoveTemp(Other.MParticleIDs))
196#endif
199#endif
200
201 {
203 RegisterArrays();
204 }
205
206 static constexpr bool IsRigidBodySim() { return SimType == EGeometryParticlesSimType::RigidBodySim; }
207
215
217 {}
218
219 FUniqueIdx UniqueIdx(const int32 Index) const { return MUniqueIdx[Index]; }
220 FUniqueIdx& UniqueIdx(const int32 Index) { return MUniqueIdx[Index]; }
221
222 ESyncState& SyncState(const int32 Index) { return MSyncState[Index].State; }
223 ESyncState SyncState(const int32 Index) const { return MSyncState[Index].State; }
224
225
226 UE_DEPRECATED(5.4, "Please use GetGeometry instead")
228
229 UE_DEPRECATED(5.4, "Please use GetGeometry instead")
231 {
232 check(false);
234 return DummyPtr;
235 }
236
237 UE_DEPRECATED(5.4, "Please use GetGeometry instead")
244
245 bool HasCollision(const int32 Index) const { return MHasCollision[Index]; }
246 bool& HasCollision(const int32 Index) { return MHasCollision[Index]; }
247
248 const FShapesArray& ShapesArray(const int32 Index) const { return reinterpret_cast<const FShapesArray&>(MShapesArray[Index]); }
249 void RemoveShapesAtSortedIndices(const int32 ParticleIndex, const TArrayView<const int32>& InIndices);
250
251 const FShapeInstanceArray& ShapeInstances(const int32 Index) const { return MShapesArray[Index]; }
252
253#if CHAOS_DETERMINISTIC
254 FParticleID ParticleID(const int32 Idx) const { return MParticleIDs[Idx]; }
255 FParticleID& ParticleID(const int32 Idx) { return MParticleIDs[Idx]; }
256#endif
257
258 UE_DEPRECATED(5.4, "Please use SetGeometry with FImplicitObjectPtr instead")
260
261 UE_DEPRECATED(5.4, "Please use SetGeometry with FImplicitObjectPtr instead")
263
264 private:
265 void RegisterArrays()
266 {
267 TArrayCollection::AddArray(&MUniqueIdx);
268#if CHAOS_DETERMINISTIC
269 TArrayCollection::AddArray(&MParticleIDs);
270#endif
271 TArrayCollection::AddArray(&MHasCollision);
272 TArrayCollection::AddArray(&MShapesArray);
273 TArrayCollection::AddArray(&MLocalBounds);
274 TArrayCollection::AddArray(&MCCDAxisThreshold);
275 TArrayCollection::AddArray(&MWorldSpaceInflatedBounds);
276 TArrayCollection::AddArray(&MHasBounds);
277 TArrayCollection::AddArray(&MSpatialIdx);
278 TArrayCollection::AddArray(&MSyncState);
279 TArrayCollection::AddArray(&MWeakParticleHandle);
280 TArrayCollection::AddArray(&MParticleConstraints);
281 TArrayCollection::AddArray(&MParticleCollisions);
282 TArrayCollection::AddArray(&MGraphNode);
283 TArrayCollection::AddArray(&MResimType);
284 TArrayCollection::AddArray(&MEnabledDuringResim);
285 TArrayCollection::AddArray(&MLightWeightDisabled);
286 TArrayCollection::AddArray(&MParticleListMask);
287
288#if CHAOS_DEBUG_NAME
290#endif
291
292 if (IsRigidBodySim())
293 {
294 TArrayCollection::AddArray(&MGeometryParticleHandle);
295 TArrayCollection::AddArray(&MGeometryParticle);
296 TArrayCollection::AddArray(&MPhysicsProxy);
297 }
298 }
299
300 virtual void SetGeometryImpl(const int32 Index, const FImplicitObjectPtr& InGeometry) override
301 {
302 // We hit these checks if there's a call to modify geometry without first clearing constraints
303 // on the particle (e.g., PBDRigidsEvolutionGBF::InvalidateParticle)
304 check(MParticleCollisions[Index].Num() == 0);
305 //check(MParticleConstraints[Index].Num() == 0);
306
308
309 UpdateShapesArray(Index);
310
311 MHasBounds[Index] = (InGeometry && InGeometry->HasBoundingBox());
312 if (MHasBounds[Index])
313 {
314 MLocalBounds[Index] = TAABB<T, d>(InGeometry->BoundingBox());
315
316 // Update the threshold we use to determine when to enable CCD. This is based on the bounds.
317 UpdateCCDAxisThreshold(Index);
318
319 // Update the world-space stat of all the shapes - must be called after UpdateShapesArray
320 // world space inflated bounds needs to take expansion into account - this is done in integrate for dynamics anyway, so
321 // this computation is mainly for statics
322 UpdateWorldSpaceState(Index, TRigidTransform<FReal, 3>(GetX(Index), GetR(Index)), FVec3(0));
323 }
324 }
325
326 void UpdateCCDAxisThreshold(const int32 Index)
327 {
328 // NOTE: We get empty bounds (as opposed to no bounds) if we have Geometry that is an empty Union
329 if (!MHasBounds[Index] || MLocalBounds[Index].IsEmpty())
330 {
331 MCCDAxisThreshold[Index] = FVec3(0);
332 return;
333 }
334
336 {
337 // Use object extents as CCD axis threshold
338 MCCDAxisThreshold[Index] = MLocalBounds[Index].Extents();
339 }
340 else if (CVars::CCDAxisThresholdMode == 1)
341 {
342 // Use thinnest object extents as all axis CCD thresholds
343 MCCDAxisThreshold[Index] = FVec3(MLocalBounds[Index].Extents().GetMin());
344 }
345 else
346 {
347 // Find minimum shape bounds thickness on each axis
348 FVec3 ThinnestBoundsPerAxis = MLocalBounds[Index].Extents();
349 for (const TUniquePtr<FPerShapeData>& Shape : ShapesArray(Index))
350 {
351 // Only sim-enabled shapes should ever be swept with CCD, so make sure the
352 // sim-enabled flag is on for each shape before considering it's min bounds
353 // for CCD extents.
354 if (Shape->GetSimEnabled() && (CVars::bCCDAxisThresholdUsesProbeShapes || !Shape->GetIsProbe()))
355 {
356 const FImplicitObjectRef Geometry = Shape->GetGeometry();
357 if (Geometry && Geometry->HasBoundingBox())
358 {
360 TVector<T, d>& CCDAxisThreshold = MCCDAxisThreshold[Index];
361 for (int32 AxisIndex = 0; AxisIndex < d; ++AxisIndex)
362 {
363 ThinnestBoundsPerAxis[AxisIndex] = FMath::Min(ShapeExtents[AxisIndex], ThinnestBoundsPerAxis[AxisIndex]);
364 }
365 }
366 }
367 }
368
370 {
371 // On each axis, use the thinnest shape bound on that axis
372 MCCDAxisThreshold[Index] = ThinnestBoundsPerAxis;
373 }
374 else if (CVars::CCDAxisThresholdMode == 3)
375 {
376 // Find the thinnest shape bound on any axis and use this for all axes
377 MCCDAxisThreshold[Index] = FVec3(ThinnestBoundsPerAxis.GetMin());
378 }
379 }
380 }
381 public:
382
383 const TAABB<T,d>& LocalBounds(const int32 Index) const
384 {
385 return MLocalBounds[Index];
386 }
387
389 {
390 return MLocalBounds[Index];
391 }
392
394 {
395 return MCCDAxisThreshold[Index];
396 }
397
398 bool HasBounds(const int32 Index) const
399 {
400 return MHasBounds[Index];
401 }
402
403 bool& HasBounds(const int32 Index)
404 {
405 return MHasBounds[Index];
406 }
407
409 {
410 return MSpatialIdx[Index];
411 }
412
414 {
415 return MSpatialIdx[Index];
416 }
417
418#if CHAOS_DEBUG_NAME
419 const TSharedPtr<FString, ESPMode::ThreadSafe>& DebugName(const int32 Index) const
420 {
421 return MDebugName[Index];
422 }
423
425 {
426 return MDebugName[Index];
427 }
428#endif
429
430 const FString& GetDebugName(const int32 Index) const
431 {
432#if CHAOS_DEBUG_NAME
433 if (MDebugName[Index].IsValid())
434 {
435 return *(MDebugName[Index].Get());
436 }
437#endif
439 }
440
442 {
443 return MWorldSpaceInflatedBounds[Index];
444 }
445
446 void UpdateWorldSpaceState(const int32 Index, const FRigidTransform3& WorldTransform, const FVec3& BoundsExpansion)
447 {
448 const FShapesArray& Shapes = ShapesArray(Index);
449
450 // If we have no shapes we are have a point bounds at our local origin
451 FAABB3 WorldBounds = (Shapes.Num() > 0) ? FAABB3::EmptyAABB() : FAABB3::ZeroAABB();
452
453 // NOTE: Individual shape bounds are not expanded. We only require that the particle bounds is expanded because that is used
454 // in the broadphase. The midphase is what requires the shape bounds and it also has all the information required to expand the shape bounds as needed.
455 for (const auto& Shape : Shapes)
456 {
457 Shape->UpdateWorldSpaceState(WorldTransform);
458 WorldBounds.GrowToInclude(Shape->GetWorldSpaceShapeBounds());
459 }
460
461 MWorldSpaceInflatedBounds[Index] = TAABB<T, d>(WorldBounds).ThickenSymmetrically(BoundsExpansion);
462 }
463
464 void UpdateWorldSpaceStateSwept(const int32 Index, const FRigidTransform3& WorldTransform, const FVec3& BoundsExpansion, const FVec3& DeltaX)
465 {
466 // Update the bounds of all shapes (individual shape bounds are not expanded) and accumulate the net bounds
467 UpdateWorldSpaceState(Index, WorldTransform, BoundsExpansion);
468
469 // Apply the swept bounds delta
470 MWorldSpaceInflatedBounds[Index].GrowByVector(DeltaX);
471 }
472
474 FORCEINLINE THandleType* Handle(int32 Index) const { return const_cast<THandleType*>(MGeometryParticleHandle[Index].Get()); }
475
477
478 FGeometryParticle* GTGeometryParticle(const int32 Index) const { return MGeometryParticle[Index]; }
479 FGeometryParticle*& GTGeometryParticle(const int32 Index) { return MGeometryParticle[Index]; }
480
481 const IPhysicsProxyBase* PhysicsProxy(const int32 Index) const { return MPhysicsProxy[Index]; }
482 IPhysicsProxyBase* PhysicsProxy(const int32 Index) { return MPhysicsProxy[Index]; }
484 {
485 MPhysicsProxy[Index] = InPhysicsProxy;
486 }
487
489 {
490 FWeakParticleHandle& WeakHandle = MWeakParticleHandle[Index];
491 if(WeakHandle.IsInitialized())
492 {
493 return WeakHandle;
494 }
495
497 return WeakHandle;
498 }
499
504 {
505 return MParticleConstraints[Index];
506 }
507
509 {
510 CHAOS_ENSURE(!MParticleConstraints[Index].Contains(InConstraintHandle));
511 MParticleConstraints[Index].Add(InConstraintHandle);
512 }
513
514
516 {
517 MParticleConstraints[Index].RemoveSingleSwap(InConstraintHandle);
518 CHAOS_ENSURE(!MParticleConstraints[Index].Contains(InConstraintHandle));
519 }
520
525 {
526 return MParticleCollisions[Index];
527 }
528
531
532 FORCEINLINE EResimType ResimType(const int32 Index) const { return MResimType[Index]; }
533 FORCEINLINE EResimType& ResimType(const int32 Index) { return MResimType[Index]; }
534
535 FORCEINLINE bool EnabledDuringResim(const int32 Index) const { return MEnabledDuringResim[Index]; }
536 FORCEINLINE bool& EnabledDuringResim(const int32 Index) { return MEnabledDuringResim[Index]; }
537
538 FORCEINLINE bool LightWeightDisabled(const int32 Index) const { return MLightWeightDisabled[Index]; }
539 FORCEINLINE bool& LightWeightDisabled(const int32 Index) { return MLightWeightDisabled[Index]; }
540
541 FORCEINLINE EGeometryParticleListMask ListMask(const int32 Index) const { return MParticleListMask[Index]; }
542 FORCEINLINE EGeometryParticleListMask& ListMask(const int32 Index) { return MParticleListMask[Index]; }
543
544 // Deprecated API
545 UE_DEPRECATED(5.3, "Use ConstraintGraphNode") const int32 ConstraintGraphIndex(const int32 Index) const { return INDEX_NONE; }
546 UE_DEPRECATED(5.3, "Use ConstraintGraphNode") int32& ConstraintGraphIndex(const int32 Index) { static int32 Dummy = INDEX_NONE; return Dummy; }
547
548private:
549 friend THandleType;
550 void ResetWeakParticleHandle(const int32 Index)
551 {
552 FWeakParticleHandle& WeakHandle = MWeakParticleHandle[Index];
553 if(WeakHandle.IsInitialized())
554 {
555 return WeakHandle.ResetHandle();
556 }
557 }
558public:
559
560 FString ToString(int32 index) const
561 {
562 FString BaseString = TParticles<T, d>::ToString(index);
563 return FString::Printf(TEXT("%s, MUniqueIdx:%d MR:%s, MGeometry:%s"), *BaseString, UniqueIdx(index).Idx, *GetR(index).ToString(), (GetGeometry(index) ? *(GetGeometry(index)->ToString()) : TEXT("none")));
564 }
565
566 virtual void Serialize(FChaosArchive& Ar) override
567 {
568 LLM_SCOPE(ELLMTag::ChaosParticles);
570
573 {
574 Ar << MShapesArray;
575 }
576
578 {
579 SerializeGeometryParticleHelper(Ar, this);
580 }
581
584 {
585 TBox<FReal, 3>::SerializeAsAABBs(Ar, MLocalBounds);
586 TBox<FReal, 3>::SerializeAsAABBs(Ar, MWorldSpaceInflatedBounds);
587 Ar << MHasBounds;
588
590 {
591 for (int32 Idx = 0; Idx < MShapesArray.Num(); ++Idx)
592 {
594 }
595 }
596 }
597 else
598 {
599 //just assume all bounds come from geometry (technically wrong for pbd rigids with only sample points, but backwards compat is not that important right now)
600 for (int32 Idx = 0; Idx < GetAllGeometry().Num(); ++Idx)
601 {
602 MHasBounds[Idx] = GetGeometry(Idx) && GetGeometry(Idx)->HasBoundingBox();
603 if (MHasBounds[Idx])
604 {
605 MLocalBounds[Idx] = TAABB<T, d>(GetGeometry(Idx)->BoundingBox());
606 //ignore velocity too, really just trying to get something reasonable)
608 }
609 }
610 }
611
613 {
614 MSpatialIdx.AddZeroed(GetAllGeometry().Num());
615 }
616 else
617 {
618 Ar << MSpatialIdx;
619 }
620
622 {
623 //no longer care about hash so don't read it and don't do anything
624 }
625 }
626
628
631
632 FORCEINLINE TArray<TAABB<T, d>>& AllLocalBounds() { return MLocalBounds; }
633 FORCEINLINE TArray<TAABB<T, d>>& AllWorldSpaceInflatedBounds() { return MWorldSpaceInflatedBounds; }
634 FORCEINLINE TArray<bool>& AllHasBounds() { return MHasBounds; }
635
636 protected:
639
640 private:
645 TArrayCollectionArray<bool> MHasCollision;
648 TArrayCollectionArray<TVector<T,d>> MCCDAxisThreshold;
649 TArrayCollectionArray<TAABB<T, d>> MWorldSpaceInflatedBounds;
658 TArrayCollectionArray<bool> MEnabledDuringResim;
659 TArrayCollectionArray<bool> MLightWeightDisabled;
661
662 CHAOS_API void UpdateShapesArray(const int32 Index);
663
664 template <typename T2, int d2, EGeometryParticlesSimType SimType2>
666
667 CHAOS_API void SerializeGeometryParticleHelper(FChaosArchive& Ar, TGeometryParticlesImp<T, d, EGeometryParticlesSimType::RigidBodySim>* GeometryParticles);
668
669 void SerializeGeometryParticleHelper(FChaosArchive& Ar, TGeometryParticlesImp<T, d, EGeometryParticlesSimType::Other>* GeometryParticles)
670 {
671 check(false); //cannot serialize this sim type
672 }
673
674#if CHAOS_DETERMINISTIC
676#endif
677#if CHAOS_DEBUG_NAME
679#endif
680 };
681
682 template <typename T, int d, EGeometryParticlesSimType SimType>
684 {
685 Particles.Serialize(Ar);
686 return Ar;
687 }
688
689 template <>
691
692 template<>
694
695}
696
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define check(expr)
Definition AssertionMacros.h:314
#define CHAOS_DEBUG_NAME
Definition BodyInstance.h:63
#define CHAOS_ENSURE(Condition)
Definition ChaosCheck.h:22
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
TSharedRef< InObjectType, InMode > MakeShared(InArgTypes &&... Args)
Definition SharedPointer.h:2009
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define CHAOS_DETERMINISTIC
Definition GeometryParticles.h:21
#define LLM_SCOPE(...)
Definition LowLevelMemTracker.h:1095
@ Num
Definition MetalRHIPrivate.h:234
ESPMode
Definition SharedPointerFwd.h:12
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
if(Failed) console_printf("Failed.\n")
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition ChaosArchive.h:167
Base class for constraint handles.
Definition ConstraintHandle.h:102
Definition ImplicitObject.h:111
virtual CHAOS_API const FAABB3 BoundingBox() const
Definition ImplicitObject.cpp:118
Knows about all the collisions detectors associated with a particular particle. Used when particles a...
Definition ParticleCollisions.h:21
Definition ShapeInstance.h:36
Definition GeometryParticles.h:50
const FShapesArray * ShapeArray
Definition GeometryParticles.h:93
const FPerShapeData * Shape
Definition GeometryParticles.h:92
FShapeOrShapesArray(const FPerShapeData *InShape)
Definition GeometryParticles.h:61
FShapeOrShapesArray(const FShapesArray *InShapeArray)
Definition GeometryParticles.h:66
bool IsSingleShape() const
Definition GeometryParticles.h:71
const FShapesArray * GetShapesArray() const
Definition GeometryParticles.h:83
FShapeOrShapesArray()
Definition GeometryParticles.h:56
bool IsValid() const
Definition GeometryParticles.h:73
const FPerShapeData * GetShape() const
Definition GeometryParticles.h:76
Definition GeometryParticles.h:107
bool IsInitialized()
Definition GeometryParticles.h:128
void ResetHandle()
Definition GeometryParticles.h:120
TGeometryParticleHandle< FReal, 3 > * GetHandle() const
Definition GeometryParticles.h:119
FWeakParticleHandle(TGeometryParticleHandle< FReal, 3 > *InHandle)
Definition GeometryParticles.h:111
TGeometryParticleHandle< FReal, 3 > * GetHandleUnsafe() const
Definition GeometryParticles.h:114
Definition IslandManager.h:41
Definition AABB.h:37
FORCEINLINE void GrowToInclude(const TVector< T, d > &V)
Definition AABB.h:393
FORCEINLINE TVector< T, d > Extents() const
Definition AABB.h:453
static FORCEINLINE TAABB< FReal, d > ZeroAABB()
Definition AABB.h:630
static FORCEINLINE TAABB< FReal, d > EmptyAABB()
Definition AABB.h:623
Definition ArrayCollectionArray.h:15
int32 AddArray(TArrayCollectionArrayBase *Array)
Definition ArrayCollection.h:36
uint32 Size() const
Definition ArrayCollection.h:66
static void SerializeAsAABBs(FArchive &Ar, TArray< TAABB< OtherType, d > > &AABBs)
Definition Box.h:484
Definition ParticleHandle.h:436
Definition ParticleHandle.h:2739
Definition GeometryParticles.h:152
FORCEINLINE bool & EnabledDuringResim(const int32 Index)
Definition GeometryParticles.h:536
FGeometryParticle *& GTGeometryParticle(const int32 Index)
Definition GeometryParticles.h:479
FUniqueIdx & UniqueIdx(const int32 Index)
Definition GeometryParticles.h:220
TGeometryParticlesImp()
Definition GeometryParticles.h:164
FParticleID & ParticleID(const int32 Idx)
Definition GeometryParticles.h:255
const IPhysicsProxyBase * PhysicsProxy(const int32 Index) const
Definition GeometryParticles.h:481
TGeometryParticlesImp(TGeometryParticlesImp< T, d, SimType > &&Other)
Definition GeometryParticles.h:172
TGeometryParticlesImp(TParticles< T, d > &&Other)
Definition GeometryParticles.h:208
const TUniquePtr< FImplicitObject > & DynamicGeometry(const int32 Index) const
Definition GeometryParticles.h:230
FORCEINLINE TArray< bool > & AllHasBounds()
Definition GeometryParticles.h:634
bool & HasBounds(const int32 Index)
Definition GeometryParticles.h:403
UE_DEPRECATED(5.3, "Use ConstraintGraphNode") int32 &ConstraintGraphIndex(const int32 Index)
Definition GeometryParticles.h:546
FORCEINLINE bool EnabledDuringResim(const int32 Index) const
Definition GeometryParticles.h:535
ESyncState & SyncState(const int32 Index)
Definition GeometryParticles.h:222
ESyncState SyncState(const int32 Index) const
Definition GeometryParticles.h:223
FSpatialAccelerationIdx SpatialIdx(const int32 Index) const
Definition GeometryParticles.h:408
FGeometryParticle * GTGeometryParticle(const int32 Index) const
Definition GeometryParticles.h:478
const FShapeInstanceArray & ShapeInstances(const int32 Index) const
Definition GeometryParticles.h:251
FParticleID ParticleID(const int32 Idx) const
Definition GeometryParticles.h:254
FORCEINLINE bool & LightWeightDisabled(const int32 Index)
Definition GeometryParticles.h:539
const TVector< T, d > & CCDAxisThreshold(const int32 Index) const
Definition GeometryParticles.h:393
void UpdateWorldSpaceState(const int32 Index, const FRigidTransform3 &WorldTransform, const FVec3 &BoundsExpansion)
Definition GeometryParticles.h:446
const FShapesArray & ShapesArray(const int32 Index) const
Definition GeometryParticles.h:248
FORCEINLINE bool LightWeightDisabled(const int32 Index) const
Definition GeometryParticles.h:538
FORCEINLINE EGeometryParticleListMask ListMask(const int32 Index) const
Definition GeometryParticles.h:541
FORCEINLINE TArray< TAABB< T, d > > & AllWorldSpaceInflatedBounds()
Definition GeometryParticles.h:633
FConstraintHandleArray & ParticleConstraints(const int32 Index)
All of the persistent (non-collision) constraints affecting the particle.
Definition GeometryParticles.h:503
FWeakParticleHandle & WeakParticleHandle(const int32 Index)
Definition GeometryParticles.h:488
FORCEINLINE EGeometryParticleListMask GetContainerListMask() const
Definition GeometryParticles.h:629
FSpatialAccelerationIdx & SpatialIdx(const int32 Index)
Definition GeometryParticles.h:413
FORCEINLINE THandleType * Handle(int32 Index) const
Definition GeometryParticles.h:474
FORCEINLINE EResimType & ResimType(const int32 Index)
Definition GeometryParticles.h:533
void RemoveConstraintHandle(const int32 &Index, FConstraintHandle *InConstraintHandle)
Definition GeometryParticles.h:515
const FString & GetDebugName(const int32 Index) const
Definition GeometryParticles.h:430
FORCEINLINE Private::FPBDIslandParticle *& ConstraintGraphNode(const int32 Index)
Definition GeometryParticles.h:530
void UpdateWorldSpaceStateSwept(const int32 Index, const FRigidTransform3 &WorldTransform, const FVec3 &BoundsExpansion, const FVec3 &DeltaX)
Definition GeometryParticles.h:464
FORCEINLINE EGeometryParticleListMask & ListMask(const int32 Index)
Definition GeometryParticles.h:542
const TAABB< T, d > & LocalBounds(const int32 Index) const
Definition GeometryParticles.h:383
FORCEINLINE EResimType ResimType(const int32 Index) const
Definition GeometryParticles.h:532
FORCEINLINE EParticleType ParticleType() const
Definition GeometryParticles.h:627
FString ToString(int32 index) const
Definition GeometryParticles.h:560
static CHAOS_API TGeometryParticlesImp< T, d, SimType > * SerializationFactory(FChaosArchive &Ar, TGeometryParticlesImp< T, d, SimType > *Particles)
Definition GeometryParticles.cpp:92
void SetContainerListMask(const EGeometryParticleListMask InMask)
Definition GeometryParticles.h:630
CHAOS_API void SetHandle(int32 Index, FGeometryParticleHandle *Handle)
Definition GeometryParticles.cpp:73
FGeometryParticleHandle THandleType
Definition GeometryParticles.h:473
EParticleType MParticleType
Definition GeometryParticles.h:637
bool HasCollision(const int32 Index) const
Definition GeometryParticles.h:245
TGeometryParticlesImp(const TGeometryParticlesImp< T, d, SimType > &Other)=delete
FParticleCollisions & ParticleCollisions(const int32 Index)
All of the collision constraints affecting the particle.
Definition GeometryParticles.h:524
const TSharedPtr< const FImplicitObject, ESPMode::ThreadSafe > & SharedGeometry(const int32 Index) const
Definition GeometryParticles.h:238
virtual void Serialize(FChaosArchive &Ar) override
Definition GeometryParticles.h:566
FORCEINLINE TArray< TAABB< T, d > > & AllLocalBounds()
Definition GeometryParticles.h:632
IPhysicsProxyBase * PhysicsProxy(const int32 Index)
Definition GeometryParticles.h:482
EGeometryParticleListMask MContainerListMask
Definition GeometryParticles.h:638
UE_DEPRECATED(5.3, "Use ConstraintGraphNode") const int32 ConstraintGraphIndex(const int32 Index) const
Definition GeometryParticles.h:545
bool HasBounds(const int32 Index) const
Definition GeometryParticles.h:398
FORCEINLINE Private::FPBDIslandParticle * ConstraintGraphNode(const int32 Index) const
Definition GeometryParticles.h:529
bool & HasCollision(const int32 Index)
Definition GeometryParticles.h:246
void RemoveShapesAtSortedIndices(const int32 ParticleIndex, const TArrayView< const int32 > &InIndices)
Definition GeometryParticles.cpp:50
virtual ~TGeometryParticlesImp()
Definition GeometryParticles.h:216
void SetSharedGeometry(const int32 Index, TSharedPtr< const FImplicitObject, ESPMode::ThreadSafe > InShared)
Definition GeometryParticles.h:262
static constexpr bool IsRigidBodySim()
Definition GeometryParticles.h:206
void SetPhysicsProxy(const int32 Index, IPhysicsProxyBase *InPhysicsProxy)
Definition GeometryParticles.h:483
const TAABB< T, d > & WorldSpaceInflatedBounds(const int32 Index) const
Definition GeometryParticles.h:441
void AddConstraintHandle(const int32 &Index, FConstraintHandle *InConstraintHandle)
Definition GeometryParticles.h:508
TAABB< T, d > & LocalBounds(const int32 Index)
Definition GeometryParticles.h:388
FUniqueIdx UniqueIdx(const int32 Index) const
Definition GeometryParticles.h:219
void SetDynamicGeometry(const int32 Index, TUniquePtr< FImplicitObject > &&InUnique)
Definition GeometryParticles.h:259
Definition Particles.h:32
const TVector< T, d > & GetX(const int32 Index) const
Definition Particles.h:156
FString ToString(int32 index) const
Definition Particles.h:166
Definition Serializable.h:10
Definition SimpleGeometryParticles.h:16
virtual void SetGeometryImpl(const int32 Index, const FImplicitObjectPtr &InGeometry)
Definition SimpleGeometryParticles.h:121
FORCEINLINE const FImplicitObjectPtr & GetGeometry(const int32 Index) const
Definition SimpleGeometryParticles.h:61
const TArrayCollectionArray< TRotation< FRealSingle, d > > & GetR() const
Definition SimpleGeometryParticles.h:58
virtual void Serialize(FChaosArchive &Ar)
Definition SimpleGeometryParticles.h:70
void SetGeometry(const int32 Index, const FImplicitObjectPtr &InGeometry)
Definition SimpleGeometryParticles.h:62
FORCEINLINE const TArray< FImplicitObjectPtr > & GetAllGeometry() const
Definition SimpleGeometryParticles.h:67
Definition Vector.h:41
virtual CORE_API void UsingCustomVersion(const struct FGuid &Guid)
Definition Archive.cpp:590
CORE_API int32 CustomVer(const struct FGuid &Key) const
Definition Archive.cpp:602
Definition PhysicsProxyBase.h:97
Definition ArrayView.h:139
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition SharedPointer.h:692
Definition UniquePtr.h:107
bool bCCDAxisThresholdUsesProbeShapes
Definition CCDUtilities.cpp:53
int32 CCDAxisThresholdMode
Definition CCDUtilities.cpp:50
FString EmptyParticleName
Definition GeometryParticles.cpp:20
int32 GetMin(const FIntVector3 &V)
Definition Utilities.h:53
Definition SkeletalMeshComponent.h:307
EParticleType
Definition GeometryParticlesfwd.h:11
FImplicitObject * FImplicitObjectRef
Definition ImplicitFwd.h:48
ESyncState
Definition GeometryParticlesfwd.h:29
EResimType
Definition GeometryParticles.h:143
TRefCountPtr< FImplicitObject > FImplicitObjectPtr
Definition ImplicitFwd.h:33
TRigidTransform< FReal, 3 > FRigidTransform3
Definition Core.h:22
FChaosArchive & operator<<(FChaosArchive &Ar, FRigidParticleControlFlags &Flags)
Definition RigidParticleControlFlags.cpp:15
FORCEINLINE uint32 GetTypeHash(const FParticleID &Unique)
Definition GeometryParticles.h:99
TVector< FReal, 3 > FVec3
Definition Core.h:17
EGeometryParticleListMask
Definition GeometryParticlesfwd.h:115
Definition OverriddenPropertySet.cpp:45
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition ParticleDirtyFlags.h:37
Definition GeometryParticlesfwd.h:59
Definition GeometryParticlesfwd.h:87
CORE_API static const FGuid GUID
Definition ExternalPhysicsCustomObjectVersion.h:144
@ SerializeShapeWorldSpaceBounds
Definition ExternalPhysicsCustomObjectVersion.h:61
@ SpatialIdxSerialized
Definition ExternalPhysicsCustomObjectVersion.h:31
@ SerializeHashResult
Definition ExternalPhysicsCustomObjectVersion.h:55
@ SerializeParticleBounds
Definition ExternalPhysicsCustomObjectVersion.h:19
@ SerializeGTGeometryParticles
Definition PhysicsObjectVersion.h:18
@ PerShapeData
Definition PhysicsObjectVersion.h:16
CORE_API static const FGuid GUID
Definition PhysicsObjectVersion.h:78