UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GeometryCollectionComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Chaos/Defines.h"
7#include "Field/FieldSystem.h"
10#include "GameFramework/Actor.h"
17#include "Templates/UniquePtr.h"
22#include "EngineDefines.h"
24#include "Math/MathFwd.h"
25
26#include "GeometryCollectionComponent.generated.h"
27
32class UBoxComponent;
42struct FDamageCollector;
44class AISMPoolActor;
49enum class EObjectStateTypeEnum : uint8;
50namespace Chaos { enum class EObjectStateType: int8; }
51template<class InElementType> class TManagedArray;
52
54
56
58
60
63
64namespace GeometryCollection
65{
66 enum class ESelectionMode : uint8
67 {
68 None = 0,
73 Parent,
75 Level,
76 Leaves,
78 };
79}
80
81USTRUCT()
83{
85
87
88 // Cache mode, whether disabled, playing or recording
89 UPROPERTY(EditAnywhere, Category = Cache)
91
92 // The cache to target when recording or playing
93 UPROPERTY(EditAnywhere, Category = Cache)
95
96 // Cache mode, whether disabled, playing or recording
97 UPROPERTY(EditAnywhere, Category = Cache)
98 float ReverseCacheBeginTime;
99
100 // Whether to buffer collisions during recording
101 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Record Collision Data"))
102 bool SaveCollisionData;
103
104 // Whether to generate collisions during playback
105 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Generate Collision Data during Playback"))
106 bool DoGenerateCollisionData;
107
108 // Maximum size of the collision buffer
109 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Collision Data Size Maximum"))
110 int32 CollisionDataSizeMax;
111
112 // Spatial hash collision data
113 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Spatial Hash Collision Data"))
114 bool DoCollisionDataSpatialHash;
115
116 // Spatial hash radius for collision data
117 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Spatial Hash Radius"))
118 float CollisionDataSpatialHashRadius;
119
120 // Maximum number of collisions per cell
121 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Maximum Number of Collisions Per Cell"))
122 int32 MaxCollisionPerCell;
123
124 // Whether to buffer breakings during recording
125 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Record Breaking Data"))
126 bool SaveBreakingData;
127
128 // Whether to generate breakings during playback
129 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Generate Breaking Data during Playback"))
130 bool DoGenerateBreakingData;
131
132 // Maximum size of the breaking buffer
133 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Breaking Data Size Maximum"))
134 int32 BreakingDataSizeMax;
135
136 // Spatial hash breaking data
137 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Spatial Hash Breaking Data"))
138 bool DoBreakingDataSpatialHash;
139
140 // Spatial hash radius for breaking data
141 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Spatial Hash Radius"))
142 float BreakingDataSpatialHashRadius;
143
144 // Maximum number of breaking per cell
145 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Maximum Number of Breakings Per Cell"))
146 int32 MaxBreakingPerCell;
147
148 // Whether to buffer trailings during recording
149 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Record Trailing Data"))
150 bool SaveTrailingData;
151
152 // Whether to generate trailings during playback
153 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Generate Trailing Data during Playback"))
154 bool DoGenerateTrailingData;
155
156 // Maximum size of the trailing buffer
157 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Trailing Data Size Maximum"))
158 int32 TrailingDataSizeMax;
159
160 // Minimum speed to record trailing
161 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Trailing Minimum Speed Threshold"))
162 float TrailingMinSpeedThreshold;
163
164 // Minimum volume to record trailing
165 UPROPERTY(EditAnywhere, Category = Cache, meta = (DisplayName = "Trailing Minimum Volume Threshold"))
166 float TrailingMinVolumeThreshold;
167};
168
169namespace GeometryCollection
170{
172 enum class EEditUpdate : uint8
173 {
175 None = 0,
177 Rest = 1 << 0,
179 Physics = 1 << 1,
181 Dynamic = 1 << 2,
186 };
188}
189
201{
202public:
211
213
214private:
216 const GeometryCollection::EEditUpdate EditUpdate;
218 bool bShapeIsUnchanged;
219 bool bPropagateToAllMatchingComponents;
220};
221
222#if WITH_EDITOR
224{
225public:
228
229 GEOMETRYCOLLECTIONENGINE_API void SetShowBoneColors(bool ShowBoneColorsIn);
230 GEOMETRYCOLLECTIONENGINE_API bool GetShowBoneColors() const;
231
233 GEOMETRYCOLLECTIONENGINE_API bool GetEnableBoneSelection() const;
234
235 GEOMETRYCOLLECTIONENGINE_API bool IsBoneSelected(int BoneIndex) const;
236 GEOMETRYCOLLECTIONENGINE_API void Sanitize();
248
249 GEOMETRYCOLLECTIONENGINE_API bool IsBoneHighlighted(int BoneIndex) const;
254
257
258private:
259 void UpdateBoneColors();
260
261 bool bUpdated;
262
263
266};
267
268#endif
269
270//Provides copy on write functionality:
271//GetArray (const access)
272//GetArrayCopyOnWrite
273//GetArrayRest (gives original rest value)
274//This generates pointers to arrays marked private. Macro assumes getters are public
275//todo(ocohen): may want to take in a static name
276#define COPY_ON_WRITE_ATTRIBUTE(Type, Name, Group) \
277 UE_DEPRECATED(5.4, "Use GetGeometryCollection()->"#Name" instead.") \
278 GEOMETRYCOLLECTIONENGINE_API const TManagedArray<Type>& Get##Name##Array() const; \
279 UE_DEPRECATED(5.4, "Use GetGeometryCollection()->"#Name" instead.") \
280 GEOMETRYCOLLECTIONENGINE_API TManagedArray<Type>& Get##Name##ArrayCopyOnWrite(); \
281 UE_DEPRECATED(5.4, "Use GetGeometryCollection()->"#Name" instead.") \
282 GEOMETRYCOLLECTIONENGINE_API void Reset##Name##ArrayDynamic(); \
283 UE_DEPRECATED(5.4, "Use GetGeometryCollection()->"#Name" instead.") \
284 GEOMETRYCOLLECTIONENGINE_API const TManagedArray<Type>& Get##Name##ArrayRest() const; \
285private: \
286 /* Deprecated */ \
287 /*TManagedArray<Type>* Indirect##Name##Array;*/ \
288public:
289
297{
299 {
300 static constexpr uint8 StateMask = 0b111;
301 static constexpr uint8 StateOffset = 0;
302 static constexpr uint8 InternalClusterMask = 0b1;
303 static constexpr uint8 InternalClusterOffset = 3;
304
306 {
307 Value &= ~Mask;
308 Value |= ((Val & Mask) << Offset);
309 }
310
312 {
313 return (Value >> Offset) & Mask;
314 }
315
320
321 void SetInternalCluster(bool bInternalCluster)
322 {
324 }
325
330
331 bool IsInternalCluster() const
332 {
334 }
335
337 };
338
343 uint16 ClusterIdx; // index of the cluster or one of its child if the cluster is internal ( see ClusterState)
345
347 {
348 return Other.ClusterState.Value != ClusterState.Value
349 || Other.ClusterIdx != ClusterIdx
350 || Other.Position != Position
351 || Other.LinearVelocity != LinearVelocity
352 || Other.AngularVelocity != AngularVelocity
353 || Other.Rotation != Rotation;
354 }
355};
356
375
377{
378 Ar << ActivatedCluster.ActivatedIndex;
379 Ar << ActivatedCluster.InitialLinearVelocity;
380 Ar << ActivatedCluster.InitialAngularVelocity;
381
382 return Ar;
383}
384
389USTRUCT()
391{
393
395 : Version(0), ServerFrame(0), bIsRootAnchored(false)
396 {
397
398 }
399
400 //Array of one off pieces that became activated
402
403 // Array of cluster data requires to synchronize clients
405
406 // Version counter, every write to the rep data is a new state so Identical only references this version
407 // as there's no reason to compare the Poses array.
409
410 // For Network Prediction Mode we require the frame number on the server when the data was gathered
412
413 // The sim-time that this rep data was received
415
416 // Is the root particle of the GC currently anchored
418
419 // Just test version to skip having to traverse the whole pose array for replication
420 bool Identical(const FGeometryCollectionRepData* Other, uint32 PortFlags) const;
421 bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
422
423 // Check if the data has changed
424 bool HasChanged(const FGeometryCollectionRepData& BaseData) const;
425
426 void Reset()
427 {
428 OneOffActivated.Reset();
429 Clusters.Reset();
430 }
431
432};
433
434template<>
436{
437 enum
438 {
441 };
442};
443
449USTRUCT()
451{
453
455 : Version(0)
456 , bIsRootAnchored(false)
457 {
458 }
459
460 // mark a transform as broken nd return true if this was a state change
461 bool SetBroken(int32 TransformIndex, int32 NumTransforms, bool bDisabled, const FVector& LinV, const FVector& AngVInRadiansPerSecond);
462
463 // version for fast comparison
465
466 // broken state of each piece of the GC
468
469 // Is the root particle of the GC currently anchored
470 // could possibily change in the future to also be a bit array
472
473 // this represents the data for when a particle is released from its parent cluster
474 // this data is added when the particle is released but will be cleared after a while
475 // so that late client will not replay the break as it is in their past
483
484 // Just test version to skip having to traverse the whole pose array for replication
485 bool Identical(const FGeometryCollectionRepStateData* Other, uint32 PortFlags) const;
486 bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
487
488 // Check if the data has changed
489 bool HasChanged(const FGeometryCollectionRepStateData& BaseData) const;
490
491 void Reset()
492 {
493 BrokenState.Reset();
494 bIsRootAnchored = 0;
495 ReleasedData.Reset();
496 }
497};
498
499template<>
501{
502 enum
503 {
506 };
507};
508
509// this structure holds entries for the tracked pieces to be replicated
510USTRUCT()
512{
514
516 {
521
522 // Index of the cluster or one of its child if the cluster is internal ( see bIsInternalCluster)
523 uint16 TransformIndex = INDEX_NONE;
524
525 // Whether this refers to an internal cluster or directly to a cluster in the geometry collection
526 uint8 bIsInternalCluster = false;
527
528 // non serialized data, used to trimn the data back when no longer updated
529 int32 LastUpdatedVersion = 0;
530
531 // comp
532 bool IsEqualPositionsAndVelocities(const FClusterData& Data) const;
533 };
534
536 : Version(0)
537 {}
538
541
542 // return true if the data has changed from stored one
543 bool SetData(const FClusterData& Data);
544
545 // return true if any entries was removed
546 bool RemoveOutOfDateClusterData();
547
548 // Just test version to skip having to traverse the whole pose array for replication
549 bool Identical(const FGeometryCollectionRepDynamicData* Other, uint32 PortFlags) const;
550 bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess);
551
552 // Check if the data has changed
553 bool HasChanged(const FGeometryCollectionRepDynamicData& BaseData) const;
554
555 void Reset()
556 {
557 ClusterData.Reset();
558 }
559};
560
561template<>
563{
564 enum
565 {
568 };
569};
570
572
576UCLASS(meta = (BlueprintSpawnableComponent), MinimalAPI)
578{
581#if WITH_EDITOR
582 friend class FScopedColorEdit;
583#endif
584 friend class FGeometryCollectionCommands;
586
587public:
588
590
591 // Collision profile name that indicates we should use the geometry collection's default collision profile.
593
594 //~ Begin UObject Interface.
595 GEOMETRYCOLLECTIONENGINE_API virtual void Serialize(FArchive& Ar) override;
596 //~ End UObject Interface.
597
598 //~ Begin UActorComponent Interface.
599 GEOMETRYCOLLECTIONENGINE_API virtual bool ShouldCreateRenderState() const override;
600 GEOMETRYCOLLECTIONENGINE_API virtual void CreateRenderState_Concurrent(FRegisterComponentContext* Context) override;
601 GEOMETRYCOLLECTIONENGINE_API virtual void SendRenderDynamicData_Concurrent() override;
602
603 UE_DEPRECATED(5.6, "Render state dirty state is now based on the geometry collection change events")
604 FORCEINLINE void SetRenderStateDirty() { /* Deprecated. */ }
605
606 GEOMETRYCOLLECTIONENGINE_API virtual void SetCollisionObjectType(ECollisionChannel Channel) override;
607 GEOMETRYCOLLECTIONENGINE_API virtual void OnActorEnableCollisionChanged() override;
608 GEOMETRYCOLLECTIONENGINE_API virtual void BeginPlay() override;
609 GEOMETRYCOLLECTIONENGINE_API virtual void EndPlay(const EEndPlayReason::Type ReasonEnd) override;
610 GEOMETRYCOLLECTIONENGINE_API virtual void OnVisibilityChanged() override;
611 GEOMETRYCOLLECTIONENGINE_API virtual void OnActorVisibilityChanged() override;
612 GEOMETRYCOLLECTIONENGINE_API virtual void OnHiddenInGameChanged() override;
613 GEOMETRYCOLLECTIONENGINE_API virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
614 GEOMETRYCOLLECTIONENGINE_API virtual void GetResourceSizeEx(FResourceSizeEx& CumulativeResourceSize) override;
615 GEOMETRYCOLLECTIONENGINE_API virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
616
617#if WITH_EDITOR
619 GEOMETRYCOLLECTIONENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
620
623 typedef FOnGeometryCollectionPropertyChangedMulticaster::FDelegate FOnGeometryCollectionPropertyChanged;
624
628#endif
629 //~ End UActorComponent Interface.
630
631 //~ Begin INavRelevantInterface Interface
632 GEOMETRYCOLLECTIONENGINE_API virtual bool IsNavigationRelevant() const override;
633 //~ End INavRelevantInterface Interface
634
635 //~ Begin USceneComponent Interface.
636 GEOMETRYCOLLECTIONENGINE_API virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
637 virtual FBoxSphereBounds CalcLocalBounds() const { return ComponentSpaceBounds; }
638
639 GEOMETRYCOLLECTIONENGINE_API virtual bool HasAnySockets() const override;
640 GEOMETRYCOLLECTIONENGINE_API virtual bool DoesSocketExist(FName InSocketName) const override;
641 GEOMETRYCOLLECTIONENGINE_API virtual FTransform GetSocketTransform(FName InSocketName, ERelativeTransformSpace TransformSpace = RTS_World) const override;
642 GEOMETRYCOLLECTIONENGINE_API virtual void QuerySupportedSockets(TArray<FComponentSocketDescription>& OutSockets) const override;
643
644 GEOMETRYCOLLECTIONENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
645 GEOMETRYCOLLECTIONENGINE_API virtual void AsyncPhysicsTickComponent(float DeltaTime, float SimTime) override;
646 //~ End USceneComponent Interface.
647
648
649 //~ Begin UPrimitiveComponent Interface.
650public:
651 GEOMETRYCOLLECTIONENGINE_API virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
652 GEOMETRYCOLLECTIONENGINE_API virtual void OnRegister() override;
653 GEOMETRYCOLLECTIONENGINE_API virtual void OnUnregister() override;
654 GEOMETRYCOLLECTIONENGINE_API virtual FBodyInstance* GetBodyInstance(FName BoneName = NAME_None, bool bGetWelded = true, int32 Index = -1) const override;
655 GEOMETRYCOLLECTIONENGINE_API virtual void SetNotifyRigidBodyCollision(bool bNewNotifyRigidBodyCollision) override;
656 GEOMETRYCOLLECTIONENGINE_API virtual bool CanEditSimulatePhysics() override;
657 GEOMETRYCOLLECTIONENGINE_API virtual void SetSimulatePhysics(bool bEnabled) override;
658 GEOMETRYCOLLECTIONENGINE_API virtual void SetEnableGravity(bool bGravityEnabled) override;
659 GEOMETRYCOLLECTIONENGINE_API virtual void AddForce(FVector Force, FName BoneName = NAME_None, bool bAccelChange = false) override;
660 GEOMETRYCOLLECTIONENGINE_API virtual void AddForceAtLocation(FVector Force, FVector WorldLocation, FName BoneName = NAME_None) override;
661 GEOMETRYCOLLECTIONENGINE_API virtual void AddImpulse(FVector Impulse, FName BoneName = NAME_None, bool bVelChange = false) override;
662 GEOMETRYCOLLECTIONENGINE_API virtual void AddImpulseAtLocation(FVector Impulse, FVector WorldLocation, FName BoneName = NAME_None) override;
663 GEOMETRYCOLLECTIONENGINE_API virtual void AddRadialForce(FVector Origin, float Radius, float Strength, ERadialImpulseFalloff Falloff, bool bAccelChange = false) override;
664 GEOMETRYCOLLECTIONENGINE_API virtual void AddRadialImpulse(FVector Origin, float Radius, float Strength, enum ERadialImpulseFalloff Falloff, bool bVelChange = false) override;
665 GEOMETRYCOLLECTIONENGINE_API virtual void AddTorqueInRadians(FVector Torque, FName BoneName = NAME_None, bool bAccelChange = false) override;
666 GEOMETRYCOLLECTIONENGINE_API virtual void PostLoad() override;
667 GEOMETRYCOLLECTIONENGINE_API virtual void SetPhysMaterialOverride(UPhysicalMaterial* NewPhysMaterial) override;
668protected:
669 GEOMETRYCOLLECTIONENGINE_API virtual void OnComponentCollisionSettingsChanged(bool bUpdateOverlaps=true) override;
670 GEOMETRYCOLLECTIONENGINE_API virtual bool CanBeUsedInPhysicsReplication(const FName BoneName = NAME_None) const override;
671 //~ End UPrimitiveComponent Interface.
672
673
674 //~ Begin UMeshComponent Interface.
675public:
676 GEOMETRYCOLLECTIONENGINE_API virtual int32 GetNumMaterials() const override;
677 GEOMETRYCOLLECTIONENGINE_API virtual UMaterialInterface* GetMaterial(int32 MaterialIndex) const override;
678 GEOMETRYCOLLECTIONENGINE_API virtual void GetUsedMaterials(TArray<UMaterialInterface*>& OutMaterials, bool bGetDebugMaterials = false) const override;
679 UE_DEPRECATED(5.7, "Please use GetMaterialRelevance with EShaderPlatform argument and not ERHIFeatureLevel::Type")
682 //~ End UMeshComponent Interface.
683
685 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintGetter=GetSolverActor, BlueprintSetter=SetSolverActor, Category = "ChaosPhysics", meta = (DisplayName = "Chaos Solver"))
686 TObjectPtr<AChaosSolverActor> ChaosSolverActor;
687
688
689
693 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
694 FBox GetLocalBounds() const { return ComponentSpaceBounds; }
695
705 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
706 GEOMETRYCOLLECTIONENGINE_API void ApplyExternalStrain(int32 ItemIndex, const FVector& Location, float Radius = 0, int32 PropagationDepth = 0, float PropagationFactor = 1, float Strain = 0);
707
717 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
718 GEOMETRYCOLLECTIONENGINE_API void ApplyInternalStrain(int32 ItemIndex, const FVector& Location, float Radius = 0, int32 PropagationDepth = 0, float PropagationFactor = 1, float Strain = 0);
719
724 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
725 GEOMETRYCOLLECTIONENGINE_API void CrumbleCluster(int32 ItemIndex);
726
731 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
732 GEOMETRYCOLLECTIONENGINE_API void CrumbleActiveClusters();
733
737 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
738 GEOMETRYCOLLECTIONENGINE_API void SetAnchoredByIndex(int32 Index, bool bAnchored);
739
743 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
744 GEOMETRYCOLLECTIONENGINE_API void SetAnchoredByBox(FBox WorldSpaceBox, bool bAnchored, int32 MaxLevel = -1);
745
749 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
750 GEOMETRYCOLLECTIONENGINE_API void SetAnchoredByTransformedBox(FBox Box, FTransform Transform, bool bAnchored, int32 MaxLevel = -1);
751
755 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
756 GEOMETRYCOLLECTIONENGINE_API void RemoveAllAnchors();
757
764 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
765 GEOMETRYCOLLECTIONENGINE_API void ApplyBreakingLinearVelocity(int32 ItemIndex, const FVector& LinearVelocity);
766
773 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
774 GEOMETRYCOLLECTIONENGINE_API void ApplyBreakingAngularVelocity(int32 ItemIndex, const FVector& AngularVelocity);
775
781 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
782 GEOMETRYCOLLECTIONENGINE_API void ApplyLinearVelocity(int32 ItemIndex, const FVector& LinearVelocity);
783
789 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
790 GEOMETRYCOLLECTIONENGINE_API void ApplyAngularVelocity(int32 ItemIndex, const FVector& AngularVelocity);
791
798 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
799 GEOMETRYCOLLECTIONENGINE_API int32 GetInitialLevel(int32 ItemIndex);
800
802 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
803 GEOMETRYCOLLECTIONENGINE_API int32 GetRootIndex() const;
804
806 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
807 GEOMETRYCOLLECTIONENGINE_API FTransform GetRootInitialTransform() const;
808
810 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
811 GEOMETRYCOLLECTIONENGINE_API FTransform GetRootCurrentTransform() const;
812
813 GEOMETRYCOLLECTIONENGINE_API FTransform GetRootCurrentComponentSpaceTransform() const;
814
815 GEOMETRYCOLLECTIONENGINE_API FTransform GetRootParticleMassOffset() const;
816
818 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
819 bool IsRootBroken() const { return BrokenAndDecayedStates.GetIsRootBroken(); }
820
825 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
826 GEOMETRYCOLLECTIONENGINE_API TArray<FTransform> GetInitialLocalRestTransforms() const;
827
833 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
834 GEOMETRYCOLLECTIONENGINE_API TArray<FTransform> GetLocalRestTransforms(bool bInitialTransforms = false) const;
835
840 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
841 GEOMETRYCOLLECTIONENGINE_API void SetLocalRestTransforms(const TArray<FTransform>& Transforms, bool bOnlyLeaves);
842
848 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
849 GEOMETRYCOLLECTIONENGINE_API void GetMassAndExtents(int32 ItemIndex, float& OutMass, FBox& OutExtents);
850
852 GEOMETRYCOLLECTIONENGINE_API virtual float GetMass() const override;
853
855 GEOMETRYCOLLECTIONENGINE_API virtual float CalculateMass(FName BoneName = NAME_None) override;
856
858 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
860
862 UFUNCTION(BlueprintCallable, CallInEditor, Category = "ChaosPhysics")
863 GEOMETRYCOLLECTIONENGINE_API void ResetState();
864
866 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
867 GEOMETRYCOLLECTIONENGINE_API FString GetDebugInfo();
868
869 inline const UGeometryCollection* GetRestCollection() const { return RestCollection; }
870
871 inline FGeometryCollectionEdit EditRestCollection(GeometryCollection::EEditUpdate EditUpdate = GeometryCollection::EEditUpdate::RestPhysicsDynamic, bool bShapeIsUnchanged = false) { return FGeometryCollectionEdit(this, EditUpdate, bShapeIsUnchanged); }
872#if WITH_EDITOR
873 inline FScopedColorEdit EditBoneSelection(bool bForceUpdate = false) { return FScopedColorEdit(this, bForceUpdate); }
874
877#endif
878
879 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
880 GEOMETRYCOLLECTIONENGINE_API void SetEnableDamageFromCollision(bool bValue);
881
882
883 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
884 GEOMETRYCOLLECTIONENGINE_API void SetAbandonedParticleCollisionProfileName(FName CollisionProfile);
885
886 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
887 GEOMETRYCOLLECTIONENGINE_API void SetPerLevelCollisionProfileNames(const TArray<FName>& ProfileNames);
888
889 UFUNCTION(BlueprintCallable, Category = "ChaosPhysics")
890 GEOMETRYCOLLECTIONENGINE_API void SetPerParticleCollisionProfileName(const TArray<int32>& BoneIds, FName ProfileName);
891
892 GEOMETRYCOLLECTIONENGINE_API void SetPerParticleCollisionProfileName(const TSet<int32>& BoneIds, FName ProfileName);
893
894 GEOMETRYCOLLECTIONENGINE_API void SetParticleCollisionProfileName(int32 BoneId, FName ProfileName, FGCCollisionProfileScopedTransaction& InProfileNameUpdateTransaction);
895
896private:
897
898 GEOMETRYCOLLECTIONENGINE_API bool UpdatePerParticleCollisionProfilesNum();
899
900public:
901
903 GEOMETRYCOLLECTIONENGINE_API int32 GetNumElements(FName Group) const;
904
905 // Update cached bounds; used e.g. when updating the exploded view of the geometry collection
906 GEOMETRYCOLLECTIONENGINE_API void UpdateCachedBounds();
907
908#define COPY_ON_WRITE_ATTRIBUTES \
909 /* Vertices Group */ \
910 COPY_ON_WRITE_ATTRIBUTE(FVector3f, Vertex, FGeometryCollection::VerticesGroup) /* GetVertexArray, GetVertexArrayCopyOnWrite, GetVertexArrayRest */ \
911 COPY_ON_WRITE_ATTRIBUTE(FLinearColor, Color, FGeometryCollection::VerticesGroup) /* GetColorArray */ \
912 COPY_ON_WRITE_ATTRIBUTE(FVector3f, TangentU, FGeometryCollection::VerticesGroup) /* GetTangentUArray */ \
913 COPY_ON_WRITE_ATTRIBUTE(FVector3f, TangentV, FGeometryCollection::VerticesGroup) /* //... */ \
914 COPY_ON_WRITE_ATTRIBUTE(FVector3f, Normal, FGeometryCollection::VerticesGroup) \
915 COPY_ON_WRITE_ATTRIBUTE(int32, BoneMap, FGeometryCollection::VerticesGroup) \
916 \
917 /* Faces Group */ \
918 COPY_ON_WRITE_ATTRIBUTE(FIntVector, Indices, FGeometryCollection::FacesGroup) \
919 COPY_ON_WRITE_ATTRIBUTE(bool, Visible, FGeometryCollection::FacesGroup) \
920 COPY_ON_WRITE_ATTRIBUTE(int32, MaterialIndex, FGeometryCollection::FacesGroup) \
921 COPY_ON_WRITE_ATTRIBUTE(int32, MaterialID, FGeometryCollection::FacesGroup) \
922 COPY_ON_WRITE_ATTRIBUTE(bool, Internal, FGeometryCollection::FacesGroup) \
923 \
924 /* Geometry Group */ \
925 COPY_ON_WRITE_ATTRIBUTE(int32, TransformIndex, FGeometryCollection::GeometryGroup) \
926 COPY_ON_WRITE_ATTRIBUTE(FBox, BoundingBox, FGeometryCollection::GeometryGroup) \
927 COPY_ON_WRITE_ATTRIBUTE(float, InnerRadius, FGeometryCollection::GeometryGroup) \
928 COPY_ON_WRITE_ATTRIBUTE(float, OuterRadius, FGeometryCollection::GeometryGroup) \
929 COPY_ON_WRITE_ATTRIBUTE(int32, VertexStart, FGeometryCollection::GeometryGroup) \
930 COPY_ON_WRITE_ATTRIBUTE(int32, VertexCount, FGeometryCollection::GeometryGroup) \
931 COPY_ON_WRITE_ATTRIBUTE(int32, FaceStart, FGeometryCollection::GeometryGroup) \
932 COPY_ON_WRITE_ATTRIBUTE(int32, FaceCount, FGeometryCollection::GeometryGroup) \
933 \
934 /* Material Group */ \
935 COPY_ON_WRITE_ATTRIBUTE(FGeometryCollectionSection, Sections, FGeometryCollection::MaterialGroup) \
936 \
937 /* Transform group */ \
938 COPY_ON_WRITE_ATTRIBUTE(FString, BoneName, FTransformCollection::TransformGroup) \
939 COPY_ON_WRITE_ATTRIBUTE(FLinearColor, BoneColor, FTransformCollection::TransformGroup) \
940 COPY_ON_WRITE_ATTRIBUTE(int32, TransformToGeometryIndex, FTransformCollection::TransformGroup) \
941 COPY_ON_WRITE_ATTRIBUTE(int32, ExemplarIndex, FTransformCollection::TransformGroup) \
942
943 // Declare all the methods
945
947 GEOMETRYCOLLECTIONENGINE_API const TManagedArray<int32>& GetParentArrayRest() const;
948
949 UPROPERTY(EditAnywhere, NoClear, BlueprintReadOnly, Category = "ChaosPhysics")
950 TObjectPtr<const UGeometryCollection> RestCollection;
951
953 UFUNCTION(BlueprintCallable, CallInEditor, Category = "ChaosPhysics", meta = (EditCondition = "RestCollection != nullptr"))
954 GEOMETRYCOLLECTIONENGINE_API void ApplyAssetDefaults();
955
956 UPROPERTY(EditAnywhere, NoClear, BlueprintReadOnly, Category = "ChaosPhysics")
957 TArray<TObjectPtr<const AFieldSystemActor>> InitializationFields;
958
959 UPROPERTY(meta = (DeprecatedProperty, DeprecationMessage = "GeometryCollection now abides the bSimulatePhysics flag from the base class."))
960 bool Simulating_DEPRECATED;
961
963
965 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|General")
967
968 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter = SetGravityGroupIndex, Category = "ChaosPhysics|General")
969 int32 GravityGroupIndex;
970
971 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
972 GEOMETRYCOLLECTIONENGINE_API void SetGravityGroupIndex(int32 InGravityGroupIndex);
973
974 // All bodies with a level greater than or equal to this will have One-Way Interaction enabled and act like debris (will not apply forces to non-debris bodies)
975 // Set to -1 to disable (no bodies will have One-Way Interaction enabled)
976 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter = SetOneWayInteractionLevel, Category = "ChaosPhysics|General")
977 int32 OneWayInteractionLevel;
978
979 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
980 GEOMETRYCOLLECTIONENGINE_API void SetOneWayInteractionLevel(int32 InOneWayInteractionLevel);
981
983 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter = SetDensityFromPhysicsMaterial, Category = "ChaosPhysics|General")
984 bool bDensityFromPhysicsMaterial;
985
986 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
987 GEOMETRYCOLLECTIONENGINE_API void SetDensityFromPhysicsMaterial(bool bInDensityFromPhysicsMaterial);
988
990 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|General")
991 bool bForceMotionBlur;
992
993 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Clustering")
994 bool EnableClustering;
995
997 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Clustering")
998 int32 ClusterGroupIndex;
999
1001 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Clustering")
1002 int32 MaxClusterLevel;
1003
1011 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Clustering")
1012 int32 MaxSimulatedLevel;
1013
1015 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter = SetDamageModel, Category = "ChaosPhysics|Damage")
1017
1018 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
1020
1021 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintGetter=GetDamageThreshold, BlueprintSetter=SetDamageThreshold, Category = "ChaosPhysics|Damage", meta = (EditCondition = "!bUseSizeSpecificDamageThreshold && DamageModel == EDamageModelTypeEnum::Chaos_Damage_Model_UserDefined_Damage_Threshold"))
1022 TArray<float> DamageThreshold;
1023
1024 UFUNCTION(BlueprintPure, BlueprintInternalUseOnly)
1025 TArray<float> GetDamageThreshold() const { return DamageThreshold; }
1026
1027 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
1028 GEOMETRYCOLLECTIONENGINE_API void SetDamageThreshold(const TArray<float>& InDamageThreshold);
1029
1031 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Damage", meta = (EditCondition = "DamageModel == EDamageModelTypeEnum::Chaos_Damage_Model_UserDefined_Damage_Threshold"))
1032 bool bUseSizeSpecificDamageThreshold;
1033
1035 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter = SetUseMaterialDamageModifiers, Category = "ChaosPhysics|Damage", meta = (EditCondition = "DamageModel == EDamageModelTypeEnum::Chaos_Damage_Model_UserDefined_Damage_Threshold"))
1036 bool bUseMaterialDamageModifiers;
1037
1038 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
1039 GEOMETRYCOLLECTIONENGINE_API void SetUseMaterialDamageModifiers(bool bInUseMaterialDamageModifiers);
1040
1042 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter = SetDamagePropagationData, Category = "ChaosPhysics|Damage")
1044
1045 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
1047
1049 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetEnableDamageFromCollision, Category = "ChaosPhysics|Damage")
1050 bool bEnableDamageFromCollision;
1051
1053 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Removal")
1054 bool bAllowRemovalOnSleep;
1055
1057 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Removal")
1058 bool bAllowRemovalOnBreak;
1059
1061 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Clustering")
1062 bool bForceUpdateActiveTransforms;
1063
1065 UPROPERTY(meta = (DeprecatedProperty, DeprecationMessage = "Connection types are defined on the asset now."))
1066 EClusterConnectionTypeEnum ClusterConnectionType_DEPRECATED;
1067
1069 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Collisions")
1070 int32 CollisionGroup;
1071
1073 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Collisions")
1074 float CollisionSampleFraction;
1075
1077 UPROPERTY(meta = (DeprecatedProperty, DeprecationMessage = "Use PhysicalMaterial instead."))
1078 float LinearEtherDrag_DEPRECATED;
1079
1081 UPROPERTY(meta=(DeprecatedProperty, DeprecationMessage="Physical material now derived from render materials, for instance overrides use PhysicalMaterialOverride."))
1082 TObjectPtr<const UChaosPhysicalMaterial> PhysicalMaterial_DEPRECATED;
1083
1085 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Initial Velocity")
1086 EInitialVelocityTypeEnum InitialVelocityType;
1087
1089 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Initial Velocity")
1090 FVector InitialLinearVelocity;
1091
1093 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Initial Velocity")
1094 FVector InitialAngularVelocity;
1095
1096 UPROPERTY(meta = (DeprecatedProperty, DeprecationMessage = "Physical material now derived from render materials, for instance overrides use Colliisons PhysicalMaterialOverride."))
1097 TObjectPtr<UPhysicalMaterial> PhysicalMaterialOverride_DEPRECATED;
1098
1099 UPROPERTY()
1101
1103 UPROPERTY()
1104 TArray<FTransform> RestTransforms;
1105
1115 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Set Dynamic State")
1116 GEOMETRYCOLLECTIONENGINE_API void ApplyKinematicField(UPARAM(DisplayName = "Field Radius") float Radius,
1117 UPARAM(DisplayName = "Center Position") FVector Position);
1118
1132 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Add Physics Field")
1133 GEOMETRYCOLLECTIONENGINE_API void ApplyPhysicsField(UPARAM(DisplayName = "Enable Field") bool Enabled,
1134 UPARAM(DisplayName = "Physics Type") EGeometryCollectionPhysicsTypeEnum Target,
1135 UPARAM(DisplayName = "Meta Data") UFieldSystemMetaData* MetaData,
1136 UPARAM(DisplayName = "Field Node") UFieldNodeBase* Field);
1137
1143
1144 UPROPERTY(BlueprintAssignable, Category = "Game|Damage")
1145 FNotifyGeometryCollectionPhysicsStateChange NotifyGeometryCollectionPhysicsStateChange;
1146
1147 GEOMETRYCOLLECTIONENGINE_API bool GetIsObjectDynamic() const;
1148
1150 UPROPERTY(BlueprintAssignable, Category = "Game|Loading")
1151 FNotifyGeometryCollectionPhysicsLoadingStateChange NotifyGeometryCollectionPhysicsLoadingStateChange;
1152
1153 bool GetIsObjectLoading() { return IsObjectLoading; }
1154
1158 /* ---------------------------------------------------------------------------------------- */
1159
1160 bool GetNotifyTrailing() const { return bNotifyTrailing; }
1161
1162 void SetShowBoneColors(bool ShowBoneColorsIn) { bShowBoneColors = ShowBoneColorsIn; }
1163 bool GetShowBoneColors() const { return bShowBoneColors; }
1164 bool GetEnableBoneSelection() const { return bEnableBoneSelection; }
1165
1166 GEOMETRYCOLLECTIONENGINE_API bool GetSuppressSelectionMaterial() const;
1167
1168 UE_DEPRECATED(5.5, "Bone Selected Material does not have a material ID anymore.")
1169 const int GetBoneSelectedMaterialID() const
1170 {
1171 return INDEX_NONE;
1172 }
1173
1174#if WITH_EDITORONLY_DATA
1175 inline const TArray<int32>& GetSelectedBones() const { return SelectedBones; }
1176 inline const TArray<int32>& GetHighlightedBones() const { return HighlightedBones; }
1177#endif
1178
1179 GEOMETRYCOLLECTIONENGINE_API FPhysScene_Chaos* GetInnerChaosScene() const;
1180 GEOMETRYCOLLECTIONENGINE_API AChaosSolverActor* GetPhysicsSolverActor() const;
1181
1182 const FGeometryCollectionPhysicsProxy* GetPhysicsProxy() const { return PhysicsProxy; }
1184
1185#if GEOMETRYCOLLECTION_EDITOR_SELECTION
1189#endif // #if GEOMETRYCOLLECTION_EDITOR_SELECTION
1190
1191#if UE_ENABLE_DEBUG_DRAWING
1193 void ForceRenderUpdateConstantData() { MarkRenderStateDirty(); }
1194
1196 void ForceRenderUpdateDynamicData() { MarkRenderDynamicDataDirty(); }
1197#endif // UE_ENABLE_DEBUG_DRAWING
1198
1199
1200 UE_DEPRECATED(5.4, "Disabled flags are no longer used.")
1201 const TArray<bool>& GetDisabledFlags() const { return DisabledFlags; }
1202
1203 GEOMETRYCOLLECTIONENGINE_API virtual void OnCreatePhysicsState() override;
1204 GEOMETRYCOLLECTIONENGINE_API void RegisterAndInitializePhysicsProxy();
1205 GEOMETRYCOLLECTIONENGINE_API virtual void OnDestroyPhysicsState() override;
1206 GEOMETRYCOLLECTIONENGINE_API virtual bool ShouldCreatePhysicsState() const override;
1207 GEOMETRYCOLLECTIONENGINE_API virtual bool HasValidPhysicsState() const override;
1208
1209 GEOMETRYCOLLECTIONENGINE_API virtual bool MoveComponentImpl(const FVector& Delta, const FQuat& NewRotation, bool bSweep, FHitResult* Hit, EMoveComponentFlags MoveFlags, ETeleportType Teleport) override;
1211
1212 // Mirrored from the proxy on a sync
1213 //TManagedArray<int32> RigidBodyIds;
1217
1219 UFUNCTION(BlueprintCallable, Category = "Physics")
1220 GEOMETRYCOLLECTIONENGINE_API void SetNotifyBreaks(bool bNewNotifyBreaks);
1221
1223 UFUNCTION(BlueprintCallable, Category = "Physics")
1224 GEOMETRYCOLLECTIONENGINE_API void SetNotifyRemovals(bool bNewNotifyRemovals);
1225
1227 UFUNCTION(BlueprintCallable, Category = "Physics")
1229
1231 UFUNCTION(BlueprintCallable, Category = "Physics")
1232 GEOMETRYCOLLECTIONENGINE_API void SetNotifyGlobalBreaks(bool bNewNotifyGlobalBreaks);
1233
1235 UFUNCTION(BlueprintCallable, Category = "Physics")
1236 GEOMETRYCOLLECTIONENGINE_API void SetNotifyGlobalCollision(bool bNewNotifyGlobalCollisions);
1237
1239 UFUNCTION(BlueprintCallable, Category = "Physics")
1240 GEOMETRYCOLLECTIONENGINE_API void SetNotifyGlobalRemovals(bool bNewNotifyGlobalRemovals);
1241
1243 UFUNCTION(BlueprintCallable, Category = "Physics")
1245
1247 virtual void NotifyBreak(const FChaosBreakEvent& Event) {};
1248
1250 virtual void NotifyRemoval(const FChaosRemovalEvent& Event) {};
1251
1252 UPROPERTY(BlueprintAssignable, Category = "Chaos")
1253 FOnChaosBreakEvent OnChaosBreakEvent;
1254
1255 UPROPERTY(BlueprintAssignable, Category = "Chaos")
1256 FOnChaosRemovalEvent OnChaosRemovalEvent;
1257
1258 UPROPERTY(BlueprintAssignable, Category = "Chaos")
1259 FOnChaosCrumblingEvent OnChaosCrumblingEvent;
1260
1261 // todo(chaos) remove when no longer necessary
1262 FOnChaosBreakEvent OnRootBreakEvent;
1263
1267
1268 GEOMETRYCOLLECTIONENGINE_API bool IsFullyDecayed() const;
1269
1270 GEOMETRYCOLLECTIONENGINE_API void DispatchBreakEvent(const FChaosBreakEvent& Event);
1271
1272 GEOMETRYCOLLECTIONENGINE_API void DispatchRemovalEvent(const FChaosRemovalEvent& Event);
1273
1274 GEOMETRYCOLLECTIONENGINE_API void DispatchCrumblingEvent(const FChaosCrumblingEvent& Event);
1275
1276 UPROPERTY(Transient, VisibleAnywhere, BlueprintReadWrite, Interp, Category = "Chaos")
1277 float DesiredCacheTime;
1278
1279 UPROPERTY(Transient, VisibleAnywhere, BlueprintReadWrite, Category = "Chaos")
1280 bool CachePlayback;
1281
1282 GEOMETRYCOLLECTIONENGINE_API bool DoCustomNavigableGeometryExport(FNavigableGeometryExport& GeomExport) const override;
1283
1285 GEOMETRYCOLLECTIONENGINE_API UPhysicalMaterial* GetPhysicalMaterial() const;
1286
1288 GEOMETRYCOLLECTIONENGINE_API void InitializeEmbeddedGeometry();
1289
1291 GEOMETRYCOLLECTIONENGINE_API void RefreshEmbeddedGeometry();
1292
1293#if WITH_EDITOR
1297 GEOMETRYCOLLECTIONENGINE_API void GetBoneColors(TArray<FColor>& OutColors) const;
1299#endif
1300
1302
1303#if WITH_EDITORONLY_DATA
1305#endif
1306
1307 // #todo should this only be available in editor?
1309
1310 // this reset the rest transform to use the rest collection asset ones
1311 GEOMETRYCOLLECTIONENGINE_API void ResetRestTransforms();
1312
1315
1317 GEOMETRYCOLLECTIONENGINE_API void SetInitialTransforms(const TArray<FTransform>& InitialTransforms);
1318
1320 GEOMETRYCOLLECTIONENGINE_API void SetInitialClusterBreaks(const TArray<int32>& ReleaseIndices);
1321
1323 UE_DEPRECATED(5.3, "Use GetComponentSpaceTransforms instead")
1324 TArray<FMatrix> GetGlobalMatrices() { return ComputeGlobalMatricesFromComponentSpaceTransforms(); }
1325
1326 UE_DEPRECATED(5.4, "Use GetComponentSpaceTransforms3f instead")
1327 GEOMETRYCOLLECTIONENGINE_API TArray<FTransform> GetComponentSpaceTransforms();
1328
1329 GEOMETRYCOLLECTIONENGINE_API const TArray<FTransform3f>& GetComponentSpaceTransforms3f();
1330
1331 GEOMETRYCOLLECTIONENGINE_API const FGeometryDynamicCollection* GetDynamicCollection() const;
1332 GEOMETRYCOLLECTIONENGINE_API FGeometryDynamicCollection* GetDynamicCollection(); // TEMP HACK?
1333
1334 void SetUpdateNavigationInTick(const bool bUpdateInTick) { bUpdateNavigationInTick = bUpdateInTick; }
1335
1336 void SetUseRootProxyForNavigation(const bool bUseRootProxyForNav) { bUseRootProxyForNavigation = bUseRootProxyForNav; }
1337
1338 // todo(chaos): Remove this and move to a cook time approach of the SM data based on the GC property
1339 UFUNCTION(BlueprintPure, BlueprintInternalUseOnly, Category = "Physics")
1340 bool GetUseStaticMeshCollisionForTraces() const { return bUseStaticMeshCollisionForTraces; }
1341
1342 // todo(chaos): Remove this and move to a cook time approach of the SM data based on the GC property
1343 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly, Category = "Physics")
1344 GEOMETRYCOLLECTIONENGINE_API void SetUseStaticMeshCollisionForTraces(bool bInUseStaticMeshCollisionForTraces);
1345
1347 IGeometryCollectionExternalRenderInterface* GetCustomRenderer() { return CustomRenderer.GetInterface(); }
1348
1350 UFUNCTION(BlueprintCallable, Category = "Physics")
1351 GEOMETRYCOLLECTIONENGINE_API void ForceBrokenForCustomRenderer(bool bForceBroken);
1352
1353 bool IsForceBrokenForCustomRenderer() const { return bForceBrokenForCustomRenderer; }
1354
1363 UFUNCTION(BlueprintCallable, Category = "Physics")
1364 bool FindLeafTransformByLineTrace(const FVector Start, const FVector End, int32& LeafTransformIndex, FName& LeafTransformName) const;
1365
1371 UFUNCTION(BlueprintCallable, Category = "Physics")
1372 GEOMETRYCOLLECTIONENGINE_API void SetRootProxyComponentSpaceTransform(int32 Index, const FTransform& RootProxyTransform);
1373
1375 GEOMETRYCOLLECTIONENGINE_API void SetRootProxyLocalTransform(int32 Index, const FTransform3f& RootProxyTransform);
1376
1378 GEOMETRYCOLLECTIONENGINE_API void ClearRootProxyLocalTransforms();
1379
1381 static GEOMETRYCOLLECTIONENGINE_API void ReregisterAllCustomRenderers();
1382
1384 void SetUpdateCustomRendererOnPostPhysicsSync(bool bValue) { bUpdateCustomRendererOnPostPhysicsSync = bValue; }
1385 bool GetUpdateCustomRendererOnPostPhysicsSync() const { return bUpdateCustomRendererOnPostPhysicsSync; }
1386
1387 UE_DEPRECATED(5.5, "SetUpdateCustomRenderer() shouldn't be called")
1388 void SetUpdateCustomRenderer(bool bValue) {}
1389
1390 UE_DEPRECATED(5.5, "Please use ForceBrokenForCustomRenderer() instead")
1391 UFUNCTION(BlueprintCallable, Category = "Physics", meta = (DeprecatedFunction, DeprecationMessage = "Please use ForceBrokenForCustomRenderer() instead"))
1392 void EnableRootProxyForCustomRenderer(bool bEnable) { ForceBrokenForCustomRenderer(!bEnable); }
1393
1394 bool ShouldUpdateComponentTransformToRootBone() const { return bUpdateComponentTransformToRootBone; }
1395
1396 double GetRootBrokenElapsedTimeInMs() const { return BrokenAndDecayedStates.GetRootBrokenElapsedTimeInMs(); }
1397
1402
1403 GEOMETRYCOLLECTIONENGINE_API const FTransform& GetPreviousComponentToWorld() const;
1404public:
1405 UPROPERTY(BlueprintAssignable, Category = "Collision")
1406 FOnChaosPhysicsCollision OnChaosPhysicsCollision;
1407
1408 UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Physics Collision"), Category = "Collision")
1409 GEOMETRYCOLLECTIONENGINE_API void ReceivePhysicsCollision(const FChaosPhysicsCollisionInfo& CollisionInfo);
1410
1411 // IChaosNotifyHandlerInterface
1412 GEOMETRYCOLLECTIONENGINE_API virtual void DispatchChaosPhysicsCollisionBlueprintEvents(const FChaosPhysicsCollisionInfo& CollisionInfo) override;
1413
1415 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events")
1416 bool bNotifyBreaks;
1417
1419 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events")
1420 bool bNotifyCollisions;
1421
1423 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events")
1424 bool bNotifyTrailing;
1425
1427 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events")
1428 bool bNotifyRemovals;
1429
1431 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events")
1432 bool bNotifyCrumblings;
1433
1435 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events", meta = (EditCondition = "bNotifyCrumblings"))
1436 bool bCrumblingEventIncludesChildren;
1437
1439 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events|Global")
1440 bool bNotifyGlobalBreaks;
1441
1443 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events|Global")
1444 bool bNotifyGlobalCollisions;
1445
1447 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events|Global")
1448 bool bNotifyGlobalRemovals;
1449
1451 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events|Global")
1452 bool bNotifyGlobalCrumblings;
1453
1455 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|Events|Global", meta = (EditCondition = "bNotifyGlobalCrumblings"))
1456 bool bGlobalCrumblingEventIncludesChildren;
1457
1458
1460 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "ChaosPhysics|General")
1461 bool bStoreVelocities;
1462
1464 bool bIsCurrentlyNavigationRelevant = true;
1465
1466protected:
1468 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|General")
1469 bool bShowBoneColors;
1470
1476 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|General")
1477 bool bUpdateComponentTransformToRootBone;
1478
1479 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Collision, AdvancedDisplay, config)
1480 bool bUseRootProxyForNavigation;
1481
1482 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Collision, AdvancedDisplay, config)
1483 bool bUpdateNavigationInTick;
1484
1485#if WITH_EDITORONLY_DATA
1486 UPROPERTY(EditAnywhere, Category = "ChaosPhysics|General")
1488
1489 UPROPERTY(BlueprintReadOnly, Category = "ChaosPhysics|General")
1491#endif
1492
1503
1504 /* Per-instance override to enable/disable replication for the geometry collection */
1505 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Network)
1506 bool bEnableReplication;
1507
1512 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Network)
1513 bool bEnableAbandonAfterLevel;
1514
1519 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter= SetAbandonedParticleCollisionProfileName, Category = Network)
1520 FName AbandonedCollisionProfileName;
1521
1523 UPROPERTY()
1524 TObjectPtr<AISMPoolActor> ISMPool_DEPRECATED;
1525
1527 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Rendering", meta = (editcondition = "bOverrideCustomRenderer", MustImplement = "/Script/GeometryCollectionEngine.GeometryCollectionExternalRenderInterface"))
1528 TObjectPtr<UClass> CustomRendererType;
1529
1531 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ChaosPhysics|Rendering", meta = (InlineEditConditionToggle))
1532 bool bOverrideCustomRenderer = false;
1533
1535 UPROPERTY()
1536 bool bAutoAssignISMPool_DEPRECATED = false;
1537
1538 void CheckFullyDecayed();
1539 bool bAlreadyFullyDecayed = false;
1540
1541 // todo(chaos): Remove the ability to change this at runtime, as we'll want to use this at cook time instead
1542 UPROPERTY(EditAnywhere, BlueprintGetter="GetUseStaticMeshCollisionForTraces", BlueprintSetter="SetUseStaticMeshCollisionForTraces", Category = "Physics")
1543 bool bUseStaticMeshCollisionForTraces = false;
1544
1551 UPROPERTY(meta = (DeprecatedProperty, DeprecationMessage = "GeometryCollection now uses ReplicationAbandonAfterLevel instead of ReplicationAbandonClusterLevel."))
1552 int32 ReplicationAbandonClusterLevel_DEPRECATED;
1553
1555 UPROPERTY(SkipSerialization)
1557
1560
1563
1565 GEOMETRYCOLLECTIONENGINE_API void ResetDynamicCollection();
1566
1569
1571 GEOMETRYCOLLECTIONENGINE_API void DispatchFieldCommand(const FFieldSystemCommand& InCommand);
1572
1573 GEOMETRYCOLLECTIONENGINE_API static Chaos::FPhysicsSolver* GetSolver(const UGeometryCollectionComponent& GeometryCollectionComponent);
1574
1575 UE_DEPRECATED(5.4, "CalculateLocalBounds is now Deprecated as it does not need to be called anymore, see ComponentSpaceBounds which replace LocalBounds")
1576 void CalculateLocalBounds() {};
1577
1578 UE_DEPRECATED(5.3, "Use ComputeBoundsFromComponentSpaceTransforms instead")
1579 GEOMETRYCOLLECTIONENGINE_API FBox ComputeBoundsFromGlobalMatrices(const FMatrix& LocalToWorldWithScale, const TArray<FMatrix>& GlobalMatricesArray) const;
1580
1581 GEOMETRYCOLLECTIONENGINE_API FBox ComputeBoundsFromComponentSpaceTransforms(const FTransform& LocalToWorldWithScale, const TArray<FTransform>& ComponentSpaceTransformsArray) const;
1582 FBox ComputeBoundsFromComponentSpaceTransforms(const FTransform& LocalToWorldWithScale, const TArray<FTransform3f>& ComponentSpaceTransformsArray) const;
1583
1584 UE_DEPRECATED(5.3, "Use FTransform version of ComputeBounds instead")
1586
1588
1589 GEOMETRYCOLLECTIONENGINE_API void RegisterForEvents();
1590 GEOMETRYCOLLECTIONENGINE_API void UpdateRBCollisionEventRegistration();
1591 GEOMETRYCOLLECTIONENGINE_API void UpdateGlobalCollisionEventRegistration();
1592 GEOMETRYCOLLECTIONENGINE_API void UpdateGlobalRemovalEventRegistration();
1593
1600 UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintSetter=SetPerLevelCollisionProfileNames, Category=Physics)
1601 TArray<FName> CollisionProfilePerLevel;
1602
1606 TArray<FName> CollisionProfilePerParticle;
1607
1612 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Network)
1613 int32 ReplicationAbandonAfterLevel;
1614
1622 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Network)
1623 int32 ReplicationMaxPositionAndVelocityCorrectionLevel;
1624
1625 UPROPERTY(ReplicatedUsing=OnRep_RepData)
1627
1628 UPROPERTY(ReplicatedUsing = OnRep_RepStateData)
1630
1631 UPROPERTY(ReplicatedUsing = OnRep_RepDynamicData)
1633
1635 UFUNCTION()
1636 GEOMETRYCOLLECTIONENGINE_API void OnRep_RepData();
1637
1638 UFUNCTION()
1639 GEOMETRYCOLLECTIONENGINE_API void OnRep_RepStateData();
1640
1641 UFUNCTION()
1642 GEOMETRYCOLLECTIONENGINE_API void OnRep_RepDynamicData();
1643
1644 GEOMETRYCOLLECTIONENGINE_API void RequestUpdateRepData();
1645 GEOMETRYCOLLECTIONENGINE_API virtual void UpdateRepData();
1646 GEOMETRYCOLLECTIONENGINE_API virtual void UpdateRepStateAndDynamicData();
1647
1649 GEOMETRYCOLLECTIONENGINE_API virtual void ResetRepData();
1650
1651 UE_DEPRECATED(5.3, "The argument-free version of ProcessRepData will be removed. Please use the version which takes DeltaTime and SimTime instead.")
1652 GEOMETRYCOLLECTIONENGINE_API virtual void ProcessRepData();
1653
1654 GEOMETRYCOLLECTIONENGINE_API virtual bool ProcessRepData(float DeltaTime, float SimTime);
1655
1656 int32 VersionProcessed = INDEX_NONE;
1657 int32 DynamicRepDataVersionProcessed = INDEX_NONE;
1658
1659 // The last time (in milliseconds) the async physics component tick fired.
1660 // We track this on the client to be able to turn off the tick for perf reasons
1661 // if we spend a lot of ticks sequentially doing nothing.
1662 int64 LastAsyncPhysicsTickMs = 0;
1663
1664private:
1665 void ProcessRepDataOnPT();
1666 void ProcessRepStateDataOnPT();
1667 void ProcessRepDynamicDataOnPT();
1668 void InitializeRemovalDynamicAttributesIfNeeded();
1669 void SendDynamicDataToSceneProxy();
1670
1671 // called when the rest transform are updated from SetRestState / ResetRestTransforms
1672 // this updates only the renderer, the dynamic collection should be initialized when calling this function
1673 void RestTransformsChanged();
1674
1675 // return the most actual transforms
1676 // this can be the rest collection ones, the overridden RestTransforms or the dynamic collection ones
1677 FTransform3f GetCurrentTransform(int32 Index) const;
1678 void ComputeCurrentGlobalsMatrices(TArray<FTransform3f>& OutTransforms) const;
1679
1680 uint8 bInitializedRemovalDynamicAttribute : 1;
1681 uint8 bEnableBoneSelection : 1;
1682 uint8 IsObjectDynamic : 1;
1683 uint8 IsObjectLoading : 1;
1684
1685 int ViewLevel;
1686
1687 uint32 NavmeshInvalidationTimeSliceIndex;
1688
1689 FCollisionFilterData InitialSimFilter;
1690 FCollisionFilterData InitialQueryFilter;
1691 float CurrentCacheTime;
1692 FChaosUserData PhysicsUserData;
1693
1694#if WITH_EDITORONLY_DATA
1697
1700#endif
1701
1702 UE_DEPRECATED(5.3, "Use ComponentSpaceTransforms instead")
1703 TArray<FMatrix> GlobalMatrices;
1704
1705 struct FComponentSpaceTransforms
1706 {
1707 public:
1708 FComponentSpaceTransforms(const UGeometryCollectionComponent* InComponent = nullptr)
1709 : RootIndex(INDEX_NONE)
1711 {
1712 bIsRootDirty = 1;
1713 bIsDirty = 1;
1714 }
1715
1717 {
1718 Transforms.SetNumUninitialized(NumTransforms);
1719 RootIndex = InRootIndex;
1720 MarkDirty();
1721 }
1722
1723 void MarkDirty()
1724 {
1725 bIsRootDirty = true;
1726 bIsDirty = true;
1727 }
1728
1729 int32 Num() const { return Transforms.Num(); }
1730
1731 SIZE_T GetAllocatedSize() const { return Transforms.GetAllocatedSize(); }
1732
1733 // request all transform to be update
1734 // this will trigger an update if it is still marked dirty
1735 const TArray<FTransform3f>& RequestAllTransforms() const;
1736
1737 // request the root transform, this may compute it if it is still marked dirty
1738 const FTransform3f& RequestRootTransform() const;
1739
1740 private:
1741 int32 RootIndex;
1742 mutable uint8 bIsRootDirty : 1;
1743 mutable uint8 bIsDirty : 1;
1744 mutable TArray<FTransform3f> Transforms;
1746 };
1747
1748 FComponentSpaceTransforms ComponentSpaceTransforms;
1749
1751 mutable FBox RootSpaceBounds;
1752
1757 mutable FBox ComponentSpaceBounds;
1758
1759 TArray<bool> EventsPlayed;
1760
1761 FGeometryCollectionPhysicsProxy* PhysicsProxy = nullptr;
1763
1764 // Temporary storage for body setup in order to initialise a dummy body instance
1766 TObjectPtr<UBodySetup> DummyBodySetup;
1767
1768#if WITH_EDITORONLY_DATA
1769 // Tracked editor actor that owns the original component so we can write back recorded caches
1770 // from PIE.
1773#endif
1774 GEOMETRYCOLLECTIONENGINE_API void SwitchRenderModels(const AActor* Actor);
1775
1776 // Event dispatcher for break, crumble, removal and collision events
1779
1780#if GEOMETRYCOLLECTION_EDITOR_SELECTION
1782#endif // #if GEOMETRYCOLLECTION_EDITOR_SELECTION
1783
1785 UPROPERTY()
1786 TArray<TObjectPtr<UInstancedStaticMeshComponent>> EmbeddedGeometryComponents;
1787
1788#if WITH_EDITORONLY_DATA
1791#endif
1792
1793 GEOMETRYCOLLECTIONENGINE_API bool IsEmbeddedGeometryValid() const;
1794 GEOMETRYCOLLECTIONENGINE_API void ClearEmbeddedGeometry();
1795
1797 GEOMETRYCOLLECTIONENGINE_API bool IsCustomRendererAvailable() const;
1799 GEOMETRYCOLLECTIONENGINE_API bool IsUsingCustomRenderer() const;
1800
1801 void InitializeCustomRenderer();
1802 GEOMETRYCOLLECTIONENGINE_API void RegisterCustomRenderer();
1803 GEOMETRYCOLLECTIONENGINE_API void UnregisterCustomRenderer();
1804
1805public:
1807 GEOMETRYCOLLECTIONENGINE_API void RefreshCustomRenderer();
1808
1810 GEOMETRYCOLLECTIONENGINE_API void RefreshRootProxies();
1811
1812private:
1813
1815 GEOMETRYCOLLECTIONENGINE_API bool CanRunSimulationInEditor() const;
1816
1818 UFUNCTION(BlueprintPure, BlueprintInternalUseOnly)
1819 AChaosSolverActor* GetSolverActor() const { return ChaosSolverActor; }
1820
1822 UFUNCTION(BlueprintCallable, BlueprintInternalUseOnly)
1824
1825 GEOMETRYCOLLECTIONENGINE_API void IncrementSleepTimer(float DeltaTime);
1826 GEOMETRYCOLLECTIONENGINE_API void IncrementBreakTimer(float DeltaTime);
1827 GEOMETRYCOLLECTIONENGINE_API bool CalculateInnerSphere(int32 TransformIndex, UE::Math::TSphere<double>& SphereOut) const;
1828 GEOMETRYCOLLECTIONENGINE_API void UpdateDecay(int32 TransformIdx, float UpdatedDecay, bool UseClusterCrumbling, bool HasDynamicInternalClusterParent, FGeometryCollectionDecayContext& ContextInOut);
1829
1830 GEOMETRYCOLLECTIONENGINE_API void UpdateAttachedChildrenTransform() const;
1831
1832 GEOMETRYCOLLECTIONENGINE_API void UpdateRenderSystemsIfNeeded(bool bDynamicCollectionDirty);
1833 GEOMETRYCOLLECTIONENGINE_API void UpdateNavigationDataIfNeeded(bool bDynamicCollectionDirty);
1834 GEOMETRYCOLLECTIONENGINE_API void UpdateRemovalIfNeeded();
1835
1836 GEOMETRYCOLLECTIONENGINE_API void BuildInitialFilterData();
1837
1838 GEOMETRYCOLLECTIONENGINE_API void LoadCollisionProfiles();
1839
1840 GEOMETRYCOLLECTIONENGINE_API void OnPostPhysicsSync();
1841
1842 GEOMETRYCOLLECTIONENGINE_API void OnPostCreateParticles();
1843
1844 GEOMETRYCOLLECTIONENGINE_API bool HasVisibleGeometry() const;
1845
1847 GEOMETRYCOLLECTIONENGINE_API TArray<FMatrix> ComputeGlobalMatricesFromComponentSpaceTransforms() const;
1848
1849 float ComputeMassScaleRelativeToAsset() const;
1850
1851 void MoveComponentToRootTransform();
1852
1854 void OnTransformsDirty();
1855
1858
1859 double LastHardsnapTimeInMs = 0;
1860
1862 int32 OneOffActivatedProcessed = 0;
1863
1864public:
1866 UPROPERTY(meta=(DeprecatedProperty, DeprecationMessage="Use PhysicalMaterial instead."))
1867 float AngularEtherDrag_DEPRECATED;
1868
1869private:
1870 struct FBrokenAndDecayedStates
1871 {
1872 public:
1874
1875 bool GetIsRootBroken() const { return bIsRootBroken; }
1876 bool GetIsBroken(int32 TransformIndex) const;
1877 bool GetHasDecayed(int32 TransformIndex) const;
1878 double GetRootBrokenEventTimeInMs() const;
1879 GEOMETRYCOLLECTIONENGINE_API double GetRootBrokenElapsedTimeInMs() const;
1880
1881 void SetRootIsBroken(bool bIsBroken);
1882 void SetIsBroken(int32 TransformIndex);
1883 void SetHasDecayed(int32 TransformIndex);
1884 void SetHasDecayedRecursive(int32 TransformIndex, const TArray<TSet<int32>>& Children);
1885
1886 // return true if any broken piece is not yet decayed
1887 bool HasAnyDecaying() const;
1888
1889 bool HasFullyDecayed() const;
1890
1891 private:
1892 int32 NumTransforms = 0;
1893 bool bIsRootBroken = false;
1894 double RootBrokenEventTimeInMs = 0;
1896 TBitArray<> HasDecayed;
1897 int32 NumDecaying = 0;
1898 };
1899
1900 FBrokenAndDecayedStates BrokenAndDecayedStates;
1901
1902 void UpdateBrokenAndDecayedStates();
1903
1904 bool ShouldCreateRootProxyComponents() const;
1905
1906 TArray<FTransform3f> RootProxyLocalTransforms;
1907
1908private:
1909
1910 enum class ENetAwakeningMode
1911 {
1912 ForceDormancyAwake,
1913 FlushNetDormancy,
1914 };
1915
1917 void FlushNetDormancyIfNeeded() const;
1918
1919 ENetAwakeningMode GetDesiredNetAwakeningMode() const;
1920
1921 //~ Begin IPhysicsComponent Interface.
1922public:
1923 GEOMETRYCOLLECTIONENGINE_API virtual Chaos::FPhysicsObject* GetPhysicsObjectById(Chaos::FPhysicsObjectId Id) const override;
1924 GEOMETRYCOLLECTIONENGINE_API virtual Chaos::FPhysicsObject* GetPhysicsObjectByName(const FName& Name) const override;
1925 GEOMETRYCOLLECTIONENGINE_API virtual TArray<Chaos::FPhysicsObject*> GetAllPhysicsObjects() const override;
1926 GEOMETRYCOLLECTIONENGINE_API virtual Chaos::FPhysicsObjectId GetIdFromGTParticle(Chaos::FGeometryParticle* Particle) const override;
1927 //~ End IPhysicsComponent Interface.
1928
1929#if WITH_EDITOR
1930 //~ Begin UActorComponent interface.
1931 GEOMETRYCOLLECTIONENGINE_API virtual bool IsHLODRelevant() const override;
1933 //~ End UActorComponent interface.
1934#endif
1935
1942 GEOMETRYCOLLECTIONENGINE_API void RebaseDynamicCollectionTransformsOnNewWorldTransform();
1943
1945};
1946
1951{
1953 {
1954 if (!ensure(GCComponentInstance))
1955 {
1956 return;
1957 }
1958
1959 bHasChanged = InGCComponentInstance->UpdatePerParticleCollisionProfilesNum();
1960 }
1961
1963 {
1964 if (!GCComponentInstance)
1965 {
1966 return;
1967 }
1968
1969 if (bHasChanged)
1970 {
1971 GCComponentInstance->LoadCollisionProfiles();
1972 }
1973 }
1974
1979
1982 {
1983 bHasChanged = true;
1984 }
1985
1986 bool IsValid() const { return GCComponentInstance != nullptr; }
1987
1988private:
1989 UGeometryCollectionComponent* GCComponentInstance = nullptr;
1990 bool bHasChanged = false;
1991};
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
EUpdateTransformFlags
Definition ActorComponent.h:95
int Volume
Definition AndroidPlatformMisc.cpp:380
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define ensure( InExpression)
Definition AssertionMacros.h:464
ERadialImpulseFalloff
Definition ChaosEngineInterface.h:91
EClusterConnectionTypeEnum
Definition ChaosSolverActor.h:34
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:38
#define DECLARE_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:23
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
ELevelTick
Definition EngineBaseTypes.h:70
ETeleportType
Definition EngineTypes.h:2401
ECollisionChannel
Definition EngineTypes.h:1088
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
return true
Definition ExternalRpcRegistry.cpp:601
const Chaos::FPhysicsSolver * GetSolver(const AGeometryCollectionActor &GeomCollectionActor)
Definition GeometryCollectionActor.cpp:49
#define COPY_ON_WRITE_ATTRIBUTES
Definition GeometryCollectionComponent.h:908
FArchive & operator<<(FArchive &Ar, FGeometryCollectionActivatedCluster &ActivatedCluster)
Definition GeometryCollectionComponent.h:376
ESimulationInitializationState
Definition GeometryCollectionSimulationCoreTypes.h:85
EDamageModelTypeEnum
Definition GeometryCollectionSimulationTypes.h:112
EObjectStateTypeEnum
Definition GeometryCollectionSimulationTypes.h:34
EInitialVelocityTypeEnum
Definition GeometryCollectionSimulationTypes.h:90
EGeometryCollectionPhysicsTypeEnum
Definition GeometryCollectionSimulationTypes.h:47
@ General
Definition MaterialExpressionFunctionInput.h:41
CacheMode
Definition MetalPipeline.cpp:839
@ Num
Definition MetalRHIPrivate.h:234
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UPARAM(...)
Definition ObjectMacros.h:748
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
EShaderPlatform
Definition RHIShaderPlatform.h:11
EGeometryCollectionCacheType
Definition RecordedTransformTrack.h:194
EMoveComponentFlags
Definition SceneComponent.h:56
ERelativeTransformSpace
Definition SceneComponent.h:43
@ RTS_World
Definition SceneComponent.h:45
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
float Val(const FString &Value)
Definition UnrealMath.cpp:3163
uint32 Offset
Definition VulkanMemory.cpp:4033
uint32 Size
Definition VulkanMemory.cpp:4034
free(DecoderMem)
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition ChaosSolverActor.h:108
Definition FieldSystemActor.h:19
Definition ISMPoolActor.h:12
Definition ParticleHandle.h:2739
Definition Archive.h:1208
Definition IDelegateInstance.h:14
Definition FieldSystem.h:522
Definition GeometryCollectionEngineRemoval.h:150
Definition GeometryCollectionComponent.h:201
GEOMETRYCOLLECTIONENGINE_API UGeometryCollection * GetRestCollection()
Definition GeometryCollectionComponent.cpp:5205
GEOMETRYCOLLECTIONENGINE_API ~FGeometryCollectionEdit()
Definition GeometryCollectionComponent.cpp:5157
Definition GeometryCollectionPhysicsProxy.h:143
Definition GeometryCollectionSceneProxy.h:136
uint32 GetAllocatedSize() const
Definition GeometryCollectionSceneProxy.cpp:747
int32 NumTransforms
Definition GeometryCollectionSceneProxy.h:203
Definition GeometryCollectionProxyData.h:90
Definition ManagedArray.h:154
Definition NameTypes.h:617
Definition UnrealType.h:3087
Definition PhysScene_Chaos.h:116
Definition PrimitiveSceneProxy.h:296
Definition ActorComponent.h:47
Definition ChaosNotifyHandlerInterface.h:68
Definition GeometryCollectionExternalRenderInterface.h:19
Definition Array.h:670
void Reset(SizeType NewSize=0)
Definition Array.h:2246
void Reset()
Definition BitArray.h:817
Definition ManagedArray.h:1099
Definition ScriptInterface.h:139
Definition SharedPointer.h:692
Definition UniquePtr.h:107
Definition ChaosPhysicalMaterial.h:23
Definition Class.h:3793
Definition FieldSystemObjects.h:126
Definition FieldSystemObjects.h:24
Definition GeometryCollectionCache.h:16
Definition GeometryCollectionComponent.h:578
virtual FBoxSphereBounds CalcLocalBounds() const
Definition GeometryCollectionComponent.h:637
void SetReplicationAbandonAfterLevel(int32 InReplicationAbandonAfterLevel)
Definition GeometryCollectionComponent.h:1400
FGeometryCollectionEdit EditRestCollection(GeometryCollection::EEditUpdate EditUpdate=GeometryCollection::EEditUpdate::RestPhysicsDynamic, bool bShapeIsUnchanged=false)
Definition GeometryCollectionComponent.h:871
void SetShowBoneColors(bool ShowBoneColorsIn)
Definition GeometryCollectionComponent.h:1162
void SetEnableReplication(bool bInEnableReplication)
Definition GeometryCollectionComponent.h:1399
bool GetShowBoneColors() const
Definition GeometryCollectionComponent.h:1163
uint8 bForceBrokenForCustomRenderer
Definition GeometryCollectionComponent.h:1494
TArray< bool > DisabledFlags
Definition GeometryCollectionComponent.h:1214
void SetReplicationMaxPositionAndVelocityCorrectionLevel(int32 InReplicationMaxPositionAndVelocityCorrectionLevel)
Definition GeometryCollectionComponent.h:1401
bool ShouldUpdateComponentTransformToRootBone() const
Definition GeometryCollectionComponent.h:1394
uint8 bCustomRendererCanUseNativeFallback
Definition GeometryCollectionComponent.h:1498
const FGeometryCollectionPhysicsProxy * GetPhysicsProxy() const
Definition GeometryCollectionComponent.h:1182
bool GetEnableBoneSelection() const
Definition GeometryCollectionComponent.h:1164
double GetRootBrokenElapsedTimeInMs() const
Definition GeometryCollectionComponent.h:1396
void SetUseRootProxyForNavigation(const bool bUseRootProxyForNav)
Definition GeometryCollectionComponent.h:1336
uint8 bForceNativeRenderer
Definition GeometryCollectionComponent.h:1502
uint8 bCustomRendererShouldUseNativeFallback
Definition GeometryCollectionComponent.h:1500
FGeometryCollectionPhysicsProxy * GetPhysicsProxy()
Definition GeometryCollectionComponent.h:1183
int32 BaseRigidBodyIndex
Definition GeometryCollectionComponent.h:1215
virtual void NotifyRemoval(const FChaosRemovalEvent &Event)
Definition GeometryCollectionComponent.h:1250
bool GetUpdateCustomRendererOnPostPhysicsSync() const
Definition GeometryCollectionComponent.h:1385
uint8 bUpdateCustomRendererOnPostPhysicsSync
Definition GeometryCollectionComponent.h:1496
static GEOMETRYCOLLECTIONENGINE_API FName DefaultCollisionProfileName
Definition GeometryCollectionComponent.h:592
bool GetNotifyTrailing() const
Definition GeometryCollectionComponent.h:1160
int32 NumParticlesAdded
Definition GeometryCollectionComponent.h:1216
Definition GeometryCollectionObject.h:393
Definition InstancedStaticMeshComponent.h:158
Definition MaterialInterface.h:296
Definition MeshComponent.h:25
Definition CoreNet.h:191
Definition PhysicalMaterial.h:104
Definition SkeletalMeshComponent.h:307
EObjectStateType
Definition ObjectState.h:10
int32 FPhysicsObjectId
Definition PhysicsObject.h:20
Type
Definition EngineTypes.h:3431
Definition SceneComponent.h:24
Definition FieldSystemNoiseAlgo.cpp:6
Definition CollectionBoundsFacade.cpp:13
ESelectionMode
Definition GeometryCollectionComponent.h:67
EEditUpdate
Definition GeometryCollectionComponent.h:173
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition PhysicsObjectInternal.h:16
Definition EngineBaseTypes.h:571
Definition BodyInstance.h:320
Definition ChaosEventType.h:84
Definition ChaosEventType.h:151
Definition ChaosNotifyHandlerInterface.h:16
Definition ChaosEventType.h:131
Definition PhysicsInterfaceTypesCore.h:199
Definition CollisionFilterData.h:46
Definition GeometryCollectionPhysicsProxy.h:811
Definition GeometryCollectionComponent.h:1951
FGCCollisionProfileScopedTransaction(UGeometryCollectionComponent *InGCComponentInstance)
Definition GeometryCollectionComponent.h:1952
bool IsValid() const
Definition GeometryCollectionComponent.h:1986
FGCCollisionProfileScopedTransaction & operator=(const FGCCollisionProfileScopedTransaction &Other)=delete
FGCCollisionProfileScopedTransaction(FGCCollisionProfileScopedTransaction &&Other)=delete
void MarkDirty()
Definition GeometryCollectionComponent.h:1981
FGCCollisionProfileScopedTransaction & operator=(FGCCollisionProfileScopedTransaction &&Other)=delete
FGCCollisionProfileScopedTransaction(FGCCollisionProfileScopedTransaction &Other)=delete
~FGCCollisionProfileScopedTransaction()
Definition GeometryCollectionComponent.h:1962
Definition GeometryCollectionComponent.h:83
Definition GeometryCollectionComponent.h:358
bool operator==(const FGeometryCollectionActivatedCluster &Other) const
Definition GeometryCollectionComponent.h:370
uint16 ActivatedIndex
Definition GeometryCollectionComponent.h:366
FVector_NetQuantize100 InitialAngularVelocity
Definition GeometryCollectionComponent.h:368
FGeometryCollectionActivatedCluster(uint16 Index, const FVector &InitialLinearVel, const FVector &InitialAngularVel)
Definition GeometryCollectionComponent.h:360
FVector_NetQuantize100 InitialLinearVelocity
Definition GeometryCollectionComponent.h:367
Definition GeometryCollectionComponent.h:299
bool IsInternalCluster() const
Definition GeometryCollectionComponent.h:331
static constexpr uint8 StateOffset
Definition GeometryCollectionComponent.h:301
static constexpr uint8 StateMask
Definition GeometryCollectionComponent.h:300
void SetMaskedValue(uint8 Val, uint8 Mask, uint8 Offset)
Definition GeometryCollectionComponent.h:305
uint8 Value
Definition GeometryCollectionComponent.h:336
static constexpr uint8 InternalClusterMask
Definition GeometryCollectionComponent.h:302
Chaos::EObjectStateType GetObjectState()
Definition GeometryCollectionComponent.h:326
void SetInternalCluster(bool bInternalCluster)
Definition GeometryCollectionComponent.h:321
static constexpr uint8 InternalClusterOffset
Definition GeometryCollectionComponent.h:303
void SetObjectState(Chaos::EObjectStateType State)
Definition GeometryCollectionComponent.h:316
uint8 GetMaskedValue(uint8 Mask, uint8 Offset) const
Definition GeometryCollectionComponent.h:311
Definition GeometryCollectionComponent.h:297
FClusterState ClusterState
Definition GeometryCollectionComponent.h:344
bool ClusterChanged(const FGeometryCollectionClusterRep &Other) const
Definition GeometryCollectionComponent.h:346
uint16 ClusterIdx
Definition GeometryCollectionComponent.h:343
FVector_NetQuantize100 LinearVelocity
Definition GeometryCollectionComponent.h:340
FVector_NetQuantize100 AngularVelocity
Definition GeometryCollectionComponent.h:341
FVector_NetQuantize100 Position
Definition GeometryCollectionComponent.h:339
FQuat Rotation
Definition GeometryCollectionComponent.h:342
Definition GeometryCollectionDamagePropagationData.h:9
Definition GeometryCollectionComponent.cpp:6491
Definition GeometryCollectionSceneProxy.h:90
Definition GeometryCollectionObject.h:98
Definition GeometryCollectionComponent.h:391
int32 ServerFrame
Definition GeometryCollectionComponent.h:411
bool bIsRootAnchored
Definition GeometryCollectionComponent.h:417
TArray< FGeometryCollectionActivatedCluster > OneOffActivated
Definition GeometryCollectionComponent.h:401
TArray< FGeometryCollectionClusterRep > Clusters
Definition GeometryCollectionComponent.h:404
void Reset()
Definition GeometryCollectionComponent.h:426
int32 Version
Definition GeometryCollectionComponent.h:408
TOptional< float > RepDataReceivedTime
Definition GeometryCollectionComponent.h:414
Definition GeometryCollectionComponent.h:516
FVector_NetQuantize10 LinearVelocity
Definition GeometryCollectionComponent.h:519
FVector_NetQuantize10 Position
Definition GeometryCollectionComponent.h:517
FVector_NetQuantize10 AngularVelocityInDegreesPerSecond
Definition GeometryCollectionComponent.h:520
FVector_NetQuantize10 EulerRotation
Definition GeometryCollectionComponent.h:518
Definition GeometryCollectionComponent.h:512
void Reset()
Definition GeometryCollectionComponent.h:555
FGeometryCollectionRepDynamicData()
Definition GeometryCollectionComponent.h:535
int32 Version
Definition GeometryCollectionComponent.h:539
TArray< FClusterData > ClusterData
Definition GeometryCollectionComponent.h:540
Definition GeometryCollectionComponent.h:477
FVector_NetQuantize10 LinearVelocity
Definition GeometryCollectionComponent.h:479
int16 TransformIndex
Definition GeometryCollectionComponent.h:478
FVector_NetQuantize10 AngularVelocityInDegreesPerSecond
Definition GeometryCollectionComponent.h:480
Definition GeometryCollectionComponent.h:451
TBitArray BrokenState
Definition GeometryCollectionComponent.h:467
TArray< FReleasedData > ReleasedData
Definition GeometryCollectionComponent.h:482
int32 Version
Definition GeometryCollectionComponent.h:464
void Reset()
Definition GeometryCollectionComponent.h:491
uint8 bIsRootAnchored
Definition GeometryCollectionComponent.h:471
Definition GeometryCollectionSection.h:13
Definition Guid.h:109
Definition HitResult.h:21
Definition MaterialRelevance.h:13
Definition NavigationSystemHelpers.h:25
Definition PSOPrecache.h:30
Definition UnrealType.h:7001
Definition UnrealType.h:6865
Definition ResourceSize.h:31
Definition NetSerialization.h:500
Definition NetSerialization.h:455
Definition ObjectPtr.h:488
Definition Optional.h:131
Definition StructOpsTypeTraits.h:11
@ WithNetSerializer
Definition StructOpsTypeTraits.h:26
@ WithIdentical
Definition StructOpsTypeTraits.h:19
Definition StructOpsTypeTraits.h:46
Definition BoxSphereBounds.h:25
Definition Sphere.h:29
UE_FORCEINLINE_HINT UE::Math::TRotator< T > Rotation() const
Definition Vector.h:834