UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ChaosBlueprint.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
6#include "Chaos/Declares.h"
7#include "Chaos/ChaosSolver.h"
9#include "EventManager.h"
10#include "EventsData.h"
11#include "HAL/ThreadSafeBool.h"
16#include "ChaosBlueprint.generated.h"
17
19
24
29
34
39
40
42UCLASS(ClassGroup = (Chaos), hidecategories = (Object, ActorComponent, Physics, Rendering, Mobility, LOD), ShowCategories = Trigger, meta = (BlueprintSpawnableComponent), MinimalAPI)
43class UChaosDestructionListener : public USceneComponent
44{
46
47public:
48 //~ Begin UObject Interface
49#if WITH_EDITOR
50 GEOMETRYCOLLECTIONENGINE_API virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
51#endif
52 //~ End UObject Interface
53
54 //~ Begin UActorComponent interface
55 GEOMETRYCOLLECTIONENGINE_API virtual void BeginPlay() override;
56 GEOMETRYCOLLECTIONENGINE_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
57 GEOMETRYCOLLECTIONENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
58 //~ End UActorComponent interface
59
60 // Whether or not collision event listening is enabled
61 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Collision Events")
63
64 // Whether or not collision event listening is enabled
65 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Breaking Events")
67
68 // Whether or not trailing event listening is enabled
69 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Trailing Events")
71
72 // Whether or not removal event listening is enabled
73 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Removal Events")
75
76 // The settings to use for collision event listening
77 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Collision Events", meta = (EditCondition = "bIsCollisionEventListeningEnabled"))
78 FChaosCollisionEventRequestSettings CollisionEventRequestSettings;
79
80 // The settings to use for breaking event listening
81 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Breaking Events", meta = (EditCondition = "bIsBreakingEventListeningEnabled"))
82 FChaosBreakingEventRequestSettings BreakingEventRequestSettings;
83
84 // The settings to use for trailing event listening
85 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Trailing Events", meta = (EditCondition = "bIsTrailingEventListeningEnabled"))
86 FChaosTrailingEventRequestSettings TrailingEventRequestSettings;
87
88 // The settings to use for removal event listening
89 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Removal Events", meta = (EditCondition = "bIsRemovalEventListeningEnabled"))
90 FChaosRemovalEventRequestSettings RemovalEventRequestSettings;
91
92 // Which chaos solver actors we're using. If empty, this listener will fallback to the "world" solver.
93 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Solvers")
95
96 // Which chaos solver actors we're using. If empty, this listener will fallback to the "world" solver.
97 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "GeometryCollections")
98 TSet<TObjectPtr<AGeometryCollectionActor>> GeometryCollectionActors; // Using TSet automatically blocks if user tries to add same actor twice
99
100 // Dynamically adds a chaos solver to the listener
101 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
103
104 // Dynamically removes a chaos solver from the listener
105 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
107
108 // Dynamically adds a chaos solver to the listener
109 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
111
112 // Dynamically removes a chaos solver from the listener
113 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
115
116 // Sets collision event request settings dynamically
117 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
119
120 // Sets breaking event request settings dynamically
121 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
123
124 // Sets trailing event request settings dynamically
125 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
127
128 // Sets removal event request settings dynamically
129 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
131
132 // Enables or disables collision event listening
133 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
135
136 // Enables or disables breaking event listening
137 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
139
140 // Enables or disables trailing event listening
141 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
143
144 // Enables or disables removal event listening
145 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
147
148 // Returns if the destruction listener is listening to any events
149 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
151
153 UPROPERTY(BlueprintAssignable)
155
157 UPROPERTY(BlueprintAssignable)
159
161 UPROPERTY(BlueprintAssignable)
163
165 UPROPERTY(BlueprintAssignable)
167
168 // Sorts collision events according to the given sort method
169 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
171
172 // Sorts breaking events according to the given sort method
173 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
175
176 // Sorts trailing events according to the given sort method
177 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
179
180 // Sorts removal events according to the given sort method
181 UFUNCTION(BlueprintCallable, Category = "Destruction Listener", meta = (WorldContext = "WorldContextObject"))
183
184private:
185 // Updates the scene component transform settings
187
188 // Retrieves data from solvers
190
191 GEOMETRYCOLLECTIONENGINE_API void ClearEvents();
193
195
196 // Task state enumeration used to track if there is an async processing task in-flight
197 enum class ETaskState
198 {
199 // If there is no filtering and sorting task in-flight
200 NoTask = 0,
201
202 // If there is a task in-flight
203 Processing,
204
205 // If there was a task in flight but it is now finished with results ready for broadcast
207 };
208 FThreadSafeCounter TaskState;
209
210 // The raw data arrays derived from the solvers
215
217
218 FThreadSafeBool bChanged;
219
224
225 // The list of rigid body solvers, used to retrieve destruction events
227
228 // The list of GeometryCollectionPhysicsProxy, used to retrieve destruction events
230
235
236public:
238 {
240 }
241
243 {
245 }
246
248 {
250 }
251
253 {
255 }
256
257 GEOMETRYCOLLECTIONENGINE_API void RegisterChaosEvents(FPhysScene* Scene);
258 GEOMETRYCOLLECTIONENGINE_API void UnregisterChaosEvents(FPhysScene* Scene);
259
262
263
264 // Chaos Event Handlers
265 GEOMETRYCOLLECTIONENGINE_API void HandleCollisionEvents(const Chaos::FCollisionEventData& CollisionData);
266 GEOMETRYCOLLECTIONENGINE_API void HandleBreakingEvents(const Chaos::FBreakingEventData& BreakingData);
268 GEOMETRYCOLLECTIONENGINE_API void HandleRemovalEvents(const Chaos::FRemovalEventData& RemovalData);
269};
EChaosBreakingSortMethod
Definition ChaosBreakingEventFilter.h:39
EChaosCollisionSortMethod
Definition ChaosCollisionEventFilter.h:59
EChaosRemovalSortMethod
Definition ChaosRemovalEventFilter.h:39
EChaosTrailingSortMethod
Definition ChaosTrailingEventFilter.h:49
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
ELevelTick
Definition EngineBaseTypes.h:70
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UPARAM(...)
Definition ObjectMacros.h:748
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition ChaosSolverActor.h:108
Definition GeometryCollectionActor.h:20
Definition PhysScene_Chaos.h:116
Definition ThreadSafeBool.h:17
Definition ThreadSafeCounter.h:14
Definition Array.h:670
Definition SharedPointer.h:692
Definition SkeletalMeshComponent.h:307
Type
Definition EngineTypes.h:3431
Definition EventsData.h:97
Definition EventsData.h:64
Definition EventsData.h:161
Definition EventsData.h:129
Definition EngineBaseTypes.h:571
Definition ChaosBreakingEventFilter.h:13
Definition ChaosBreakingEventFilter.h:51
Definition ChaosCollisionEventFilter.h:13
Definition ChaosCollisionEventFilter.h:72
Definition ChaosRemovalEventFilter.h:13
Definition ChaosRemovalEventFilter.h:49
Definition ChaosTrailingEventFilter.h:13
Definition ChaosTrailingEventFilter.h:60
Definition UnrealType.h:6865
Definition ObjectPtr.h:488