UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FieldSystemComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Field/FieldSystem.h"
11
12#include "FieldSystemComponent.generated.h"
13
16
18//*
19//*/
20//UENUM(BlueprintType)
21//enum class EChaosObjectType
22//{
23// Chaos_Destruction UMETA(DisplayName = "Set Always", ToolTip = "The particle output value will be equal to Interior-value if the particle position is inside a sphere / Exterior-value otherwise."),
24// Chaos_Rigid,
25//
26// Chaos_Rban UMETA(DisplayName = "Merge Interior", ToolTip = "The particle output value will be equal to Interior-value if the particle position is inside the sphere or if the particle input value is already Interior-Value / Exterior-value otherwise."),
27// Chaos_Cloth UMETA(DisplayName = "Merge Exterior", ToolTip = "The particle output value will be equal to Exterior-value if the particle position is outside the sphere or if the particle input value is already Exterior-Value / Interior-value otherwise."),
28// //~~~
29// //256th entry
30// Chaos_Objects_Max UMETA(Hidden)
31//};
32
36UCLASS(meta = (BlueprintSpawnableComponent), MinimalAPI)
37class UFieldSystemComponent : public UPrimitiveComponent
38{
40 friend class FFieldSystemEditorCommands;
41
42public:
43 //~ Begin USceneComponent Interface.
44 virtual bool HasAnySockets() const override { return false; }
45 //~ Begin USceneComponent Interface.
46
47 //~ Begin UPrimitiveComponent Interface.
48 FIELDSYSTEMENGINE_API virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
49 //~ End UPrimitiveComponent Interface.
50
53
55 inline const UFieldSystem* GetFieldSystem() const { return FieldSystem; }
56
58 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = "Field", meta = (ToolTip = "Field system asset to be used to store the construction fields. This asset is not required anymore and will be deprecated soon."))
60
62 UPROPERTY(EditAnywhere, Category = "Field", meta = (ToolTip = "If enabled the field will be pushed to the world fields and will be available to materials and niagara"))
63 bool bIsWorldField;
64
66 UPROPERTY(EditAnywhere, Category = "Field", meta = (ToolTip = "If enabled the field will be used by all the chaos solvers"))
67 bool bIsChaosField;
68
70 UPROPERTY(EditAnywhere, Category = "Field", meta = (EditCondition = "bIsChaosField == true", ToolTip = "List of chaos solvers that will use the field"))
72
74 UPROPERTY()
75 FFieldObjectCommands ConstructionCommands;
76
78 UPROPERTY()
79 FFieldObjectCommands BufferCommands;
80
81 //
82 // Blueprint based field interface
83 //
84
95 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Apply Uniform Force", meta = (UnsafeDuringActorConstruction = "true"))
96 FIELDSYSTEMENGINE_API void ApplyLinearForce(UPARAM(DisplayName = "Enable Field") bool Enabled,
97 UPARAM(DisplayName = "Uniform Direction") FVector Direction,
98 UPARAM(DisplayName = "Field Magnitude") float Magnitude);
99
110 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Set Dynamic State", meta = (UnsafeDuringActorConstruction = "true"))
111 FIELDSYSTEMENGINE_API void ApplyStayDynamicField(UPARAM(DisplayName = "Enable Field") bool Enabled,
112 UPARAM(DisplayName = "Center Position") FVector Position,
113 UPARAM(DisplayName = "Field Radius") float Radius);
114
125 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Apply Radial Force", meta = (UnsafeDuringActorConstruction = "true"))
126 FIELDSYSTEMENGINE_API void ApplyRadialForce(UPARAM(DisplayName = "Enable Field") bool Enabled,
127 UPARAM(DisplayName = "Center Position") FVector Position,
128 UPARAM(DisplayName = "Field Magnitude") float Magnitude);
129
142 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Falloff Radial Force", meta = (UnsafeDuringActorConstruction = "true"))
143 FIELDSYSTEMENGINE_API void ApplyRadialVectorFalloffForce(UPARAM(DisplayName = "Enable Field") bool Enabled,
144 UPARAM(DisplayName = "Center Position") FVector Position,
145 UPARAM(DisplayName = "Falloff Radius") float Radius,
146 UPARAM(DisplayName = "Field Magnitude") float Magnitude);
147
161 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Falloff Uniform Force", meta = (UnsafeDuringActorConstruction = "true"))
162 FIELDSYSTEMENGINE_API void ApplyUniformVectorFalloffForce(UPARAM(DisplayName = "Enable Field") bool Enabled,
163 UPARAM(DisplayName = "Center Position") FVector Position,
164 UPARAM(DisplayName = "Uniform Direction") FVector Direction,
165 UPARAM(DisplayName = "Falloff Radius") float Radius,
166 UPARAM(DisplayName = "Field Magnitude") float Magnitude);
167
181 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Apply External Strain", meta = (UnsafeDuringActorConstruction = "true"))
182 FIELDSYSTEMENGINE_API void ApplyStrainField(UPARAM(DisplayName = "Enable Field") bool Enabled,
183 UPARAM(DisplayName = "Center Position") FVector Position,
184 UPARAM(DisplayName = "Falloff Radius") float Radius,
185 UPARAM(DisplayName = "Field Magnitude") float Magnitude,
186 UPARAM(DisplayName = "Cluster Levels") int32 Iterations);
187
201 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Add Transient Field", meta = (UnsafeDuringActorConstruction = "true"))
202 FIELDSYSTEMENGINE_API void ApplyPhysicsField(UPARAM(DisplayName = "Enable Field") bool Enabled,
203 UPARAM(DisplayName = "Physics Type") EFieldPhysicsType Target,
204 UPARAM(DisplayName = "Meta Data") UFieldSystemMetaData* MetaData,
205 UPARAM(DisplayName = "Field Node") UFieldNodeBase* Field);
206
207 //
208 // Blueprint persistent field interface
209 //
210
225 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Add Persistent Field", meta = (UnsafeDuringActorConstruction = "true"))
226 FIELDSYSTEMENGINE_API void AddPersistentField(UPARAM(DisplayName = "Enable Field") bool Enabled,
227 UPARAM(DisplayName = "Physics Type") EFieldPhysicsType Target,
228 UPARAM(DisplayName = "Meta Data") UFieldSystemMetaData* MetaData,
229 UPARAM(DisplayName = "Field Node") UFieldNodeBase* Field);
230
236 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Remove Persistent Fields", meta = (UnsafeDuringActorConstruction = "true"))
237 FIELDSYSTEMENGINE_API void RemovePersistentFields();
238
239 //
240 // Blueprint construction field interface
241 //
242
258 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Add Construction Field")
259 FIELDSYSTEMENGINE_API void AddFieldCommand(UPARAM(DisplayName = "Enable Field") bool Enabled,
260 UPARAM(DisplayName = "Physics Type") EFieldPhysicsType Target,
261 UPARAM(DisplayName = "Meta Data") UFieldSystemMetaData* MetaData,
262 UPARAM(DisplayName = "Field Node") UFieldNodeBase* Field);
263
270 UFUNCTION(BlueprintCallable, Category = "Field", DisplayName = "Remove Construction Fields")
271 FIELDSYSTEMENGINE_API void ResetFieldSystem();
272
274 const TArray< FFieldSystemCommand >& GetConstructionFields() const { return SetupConstructionFields; }
275
276protected:
277
279 FIELDSYSTEMENGINE_API TSet<FPhysScene_Chaos*> GetPhysicsScenes() const;
280
283
285 FIELDSYSTEMENGINE_API void BuildFieldCommand(bool Enabled, EFieldPhysicsType Target, UFieldSystemMetaData* MetaData, UFieldNodeBase* Field, const bool IsTransient);
286
288 FIELDSYSTEMENGINE_API void DispatchFieldCommand(const FFieldSystemCommand& InCommand, const bool IsTransient);
289
291 FIELDSYSTEMENGINE_API void ClearFieldCommands();
292
293 //~ Begin UActorComponent Interface.
294 FIELDSYSTEMENGINE_API virtual void OnCreatePhysicsState() override;
295 FIELDSYSTEMENGINE_API virtual void OnDestroyPhysicsState() override;
296 FIELDSYSTEMENGINE_API virtual bool ShouldCreatePhysicsState() const override;
297 FIELDSYSTEMENGINE_API virtual bool HasValidPhysicsState() const override;
298 //~ End UActorComponent Interface.
299
302
305
308
311
314
317};
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
return true
Definition ExternalRpcRegistry.cpp:601
EFieldPhysicsType
Definition FieldSystemTypes.h:148
#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
Definition ChaosSolverActor.h:108
Definition ChaosSolversModule.h:146
Definition FieldSystem.h:522
Definition PrimitiveSceneProxy.h:296
Definition Array.h:670
Definition FieldSystemObjects.h:126
‍**
Definition FieldSystemComponent.h:38
TArray< FFieldSystemCommand > WorldGPUPersistentFields
Definition FieldSystemComponent.h:313
FChaosSolversModule * ChaosModule
Definition FieldSystemComponent.h:301
TArray< FFieldSystemCommand > SetupConstructionFields
Definition FieldSystemComponent.h:307
void SetFieldSystem(UFieldSystem *FieldSystemIn)
Definition FieldSystemComponent.h:52
const UFieldSystem * GetFieldSystem() const
Definition FieldSystemComponent.h:55
TArray< FFieldSystemCommand > WorldCPUPersistentFields
Definition FieldSystemComponent.h:316
TArray< FFieldSystemCommand > ChaosPersistentFields
Definition FieldSystemComponent.h:310
bool bHasPhysicsState
Definition FieldSystemComponent.h:304
Definition FieldSystemObjects.h:24
Definition FieldSystemAsset.h:21
Definition FieldSystemNoiseAlgo.cpp:6
Definition FieldSystemObjects.h:926
Definition FieldSystemSceneProxy.h:12
Definition ObjectPtr.h:488
Definition SoftObjectPtr.h:174