UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FieldSystemTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
6
7#include "FieldSystemTypes.generated.h"
8
12UENUM(BlueprintType)
14{
15 Field_Set_Always 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."),
16 Field_Set_IFF_NOT_Interior 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."),
17 Field_Set_IFF_NOT_Exterior 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."),
18 //~~~
19 //256th entry
21};
22
26UENUM(BlueprintType)
28{
29 Field_Wave_Cosine UMETA(DisplayName = "Cosine", ToolTip = "Cosine wave that will move in time."),
30 Field_Wave_Gaussian UMETA(DisplayName = "Gaussian", ToolTip = "Gaussian wave that will move in time."),
31 Field_Wave_Falloff UMETA(DisplayName = "Falloff", ToolTip = "The radial falloff radius will move along temporal wave."),
32 Field_Wave_Decay UMETA(DisplayName = "Decay", ToolTip = "The magnitude of the field will decay in time."),
33 //~~~
34 //256th entry
36};
37
41UENUM(BlueprintType)
43{
44 Field_Multiply UMETA(DisplayName = "Multiply", ToolTip = "Multiply the fields output values : Output = Left * Right"),
45 Field_Divide UMETA(DisplayName = "Divide", ToolTip = "Divide the fields output values : Output = Left / Right"),
46 Field_Add UMETA(DisplayName = "Add", ToolTip = "Add the fields output values : Output = Left + Right"),
47 Field_Substract UMETA(DisplayName = "Subtract", ToolTip = "Subtract the fields output : Output = Left - Right"),
48 //~~~
49 //256th entry
51};
52
56UENUM(BlueprintType)
58{
59 Field_Culling_Inside UMETA(DisplayName = "Inside", ToolTip = "Evaluate the input field if the result of the culling field is equal to 0"),
60 Field_Culling_Outside UMETA(DisplayName = "Outside", ToolTip = "Evaluate the input field if the result of the culling field is different from 0"),
61 //~~~
62 //256th entry
64};
65
66
70UENUM(BlueprintType)
72{
73 Field_Resolution_Minimal UMETA(DisplayName = "Minimum", ToolTip = "Apply the field to all the active particles"),
74 Field_Resolution_DisabledParents UMETA(DisplayName = "Parents", ToolTip = "Apply the field to all the parent particles"),
75 Field_Resolution_Maximum UMETA(DisplayName = "Maximum", ToolTip = "Apply the field to all the solver particles"),
76 //~~~
77 //256th entry
79};
80
84UENUM(BlueprintType)
86{
87 Field_Filter_Dynamic UMETA(DisplayName = "Dynamic", ToolTip = "Apply the field to all the dynamic particles"),
88 Field_Filter_Kinematic UMETA(DisplayName = "Kinematic", ToolTip = "Apply the field to all the kinematic particles"),
89 Field_Filter_Static UMETA(DisplayName = "Static", ToolTip = "Apply the field to all the static particles"),
90 Field_Filter_All UMETA(DisplayName = "All", ToolTip = "Apply the field to all the solver particles"),
91 Field_Filter_Sleeping UMETA(DisplayName = "Sleeping", ToolTip = "Apply the field to all the sleeping particles"),
92 Field_Filter_Disabled UMETA(DisplayName = "Disabled", ToolTip = "Apply the field to all the disabled particles"),
93 //~~~
94 //256th entry
96};
97
101UENUM(BlueprintType)
103{
104 Field_Object_Rigid UMETA(DisplayName = "Rigid", ToolTip = "Apply the field to all the rigid particles"),
105 Field_Object_Cloth UMETA(DisplayName = "Cloth", ToolTip = "Apply the field to all the cloth particles"),
106 Field_Object_Destruction UMETA(DisplayName = "Destruction", ToolTip = "Apply the field to all the destruction particles"),
107 Field_Object_Character UMETA(DisplayName = "Character", ToolTip = "Apply the field to all the character particles"),
108 Field_Object_All UMETA(DisplayName = "All", ToolTip = "Apply the field to all the objects particles"),
109 //~~~
110 //256th entry
112};
113
117UENUM(BlueprintType)
119{
120 Field_Position_CenterOfMass UMETA(DisplayName = "CenterOfMass", ToolTip = "Apply the field to the particles center of mass position"),
121 Field_Position_PivotPoint UMETA(DisplayName = "PivotPoint", ToolTip = "Apply the field to the particles pivot point position"),
122 //~~~
123 //256th entry
125};
126
130UENUM(BlueprintType)
132{
133 Field_FallOff_None UMETA(DisplayName = "None", ToolTip = "No falloff function is used"),
134 Field_Falloff_Linear UMETA(DisplayName = "Linear", ToolTip = "The falloff function will be proportional to x"),
135 Field_Falloff_Inverse UMETA(DisplayName = "Inverse", ToolTip = "The falloff function will be proportional to 1.0/x"),
136 Field_Falloff_Squared UMETA(DisplayName = "Squared", ToolTip = "The falloff function will be proportional to x*x"),
137 Field_Falloff_Logarithmic UMETA(DisplayName = "Logarithmic", ToolTip = "The falloff function will be proportional to log(x)"),
138 //~~~
139 //256th entry
141};
142
146UENUM(BlueprintType)
148{
150 Field_DynamicState UMETA(DisplayName = "Dynamic State", ToolTip = "Set the dynamic state of a particle (static, dynamic, kinematic...)"),
151 Field_LinearForce UMETA(DisplayName = "Linear Force", ToolTip = "Add a vector field to the particles linear force."),
152 Field_ExternalClusterStrain UMETA(DisplayName = "External Strain", ToolTip = "Apply an external strain over the particles. If this strain is over the internal one, the cluster will break."),
153 Field_Kill UMETA(DisplayName = "Kill Particle", ToolTip = "Disable the particles for which the field will be higher than 0."),
154 Field_LinearVelocity UMETA(DisplayName = "Linear Velocity", ToolTip = "Add a vector field to the particles linear velocity."),
155 Field_AngularVelociy UMETA(DisplayName = "Angular Velocity", ToolTip = "Add a vector field to the particles angular velocity."),
156 Field_AngularTorque UMETA(DisplayName = "Angular Torque", ToolTip = "Add a vector field to the particles angular torque."),
157 Field_InternalClusterStrain UMETA(DisplayName = "Internal Strain", ToolTip = "Add a strain field to the particles internal one."),
158 Field_DisableThreshold UMETA(DisplayName = "Disabled Threshold", ToolTip = "Disable the particles if their linear and angular velocity are less than the threshold."),
159 Field_SleepingThreshold UMETA(DisplayName = "Sleeping Threshold", ToolTip = "Set particles in sleeping mode if their linear and angular velocity are less than the threshold."),
160 Field_PositionStatic UMETA(DisplayName = "Position Static", ToolTip = "Add a position constraint to the particles to remain static", Hidden),
161 Field_PositionAnimated UMETA(DisplayName = "Position Animated", ToolTip = "Add a position constraint to the particles to follow its kinematic position", Hidden),
162 Field_PositionTarget UMETA(DisplayName = "Position Target", ToolTip = "Add a position constraint to the particles to follow a target position", Hidden),
163 Field_DynamicConstraint UMETA(DisplayName = "Dynamic Constraint", ToolTip = "Add the particles to a spring constraint holding them together", Hidden),
164 Field_CollisionGroup UMETA(DisplayName = "Collision Group", ToolTip = "Set the particles collision group."),
165 Field_ActivateDisabled UMETA(DisplayName = "Activate Disabled", ToolTip = "Activate all the disabled particles for which the field value will be 0"),
166 Field_InitialLinearVelocity UMETA(DisplayName = "Initial Linear Velocity", ToolTip = "Set the geometry collection initial linear velocity", Hidden),
167 Field_InitialAngularVelocity UMETA(DisplayName = "Initial Angular Velocity", ToolTip = "Set the geometry collection initial angular velocity", Hidden),
168 Field_LinearImpulse UMETA(DisplayName = "Linear Impulse", ToolTip = "Add a vector field affecting the particles linear impulse.", Hidden),
169 //~~~
170 //256th entry
172};
173
174// TODO : Refactor these 3 enums to be in sync with the GetFieldTargetTypes
175UENUM(BlueprintType)
177{
178 Vector_LinearForce UMETA(DisplayName = "Linear Force", ToolTip = "Add a vector field to the particles linear force."),
179 Vector_LinearVelocity UMETA(DisplayName = "Linear Velocity", ToolTip = "Add a vector field to the particles linear velocity."),
180 Vector_AngularVelocity UMETA(DisplayName = "Angular Velocity", ToolTip = "Add a vector field to the particles angular velocity."),
181 Vector_AngularTorque UMETA(DisplayName = "Angular Torque", ToolTip = "Add a vector field to the particles angular torque."),
182 Vector_PositionTarget UMETA(DisplayName = "Position Target", ToolTip = "Add a position constraint to the particles to follow a target position", Hidden),
183 Vector_InitialLinearVelocity UMETA(DisplayName = "Initial Linear Velocity", ToolTip = "Set the geometry collection initial linear velocity", Hidden),
184 Vector_InitialAngularVelocity UMETA(DisplayName = "Initial Angular Velocity", ToolTip = "Set the geometry collection initial angular velocity", Hidden),
185 Vector_LinearImpulse UMETA(DisplayName = "Linear Impulse", ToolTip = "Add a vector field affecting the particles linear impulse.", Hidden),
186
187 //~~~
188 //256th entry
190};
191
192UENUM(BlueprintType)
194{
195 Scalar_ExternalClusterStrain UMETA(DisplayName = "External Strain", ToolTip = "Apply an external strain over the particles. If this strain is over the internal one, the cluster will break."),
196 Scalar_Kill UMETA(DisplayName = "Kill Particle", ToolTip = "Disable the particles for which the field will be higher than 0."),
197 Scalar_DisableThreshold UMETA(DisplayName = "Disabled Threshold", ToolTip = "Disable the particles if their linear and angular velocity are less than the threshold."),
198 Scalar_SleepingThreshold UMETA(DisplayName = "Sleeping Threshold", ToolTip = "Set particles in sleeping mode if their linear and angular velocity are less than the threshold."),
199 Scalar_InternalClusterStrain UMETA(DisplayName = "Internal Strain", ToolTip = "Add a strain field to the particles internal one."),
200 Scalar_DynamicConstraint UMETA(DisplayName = "Dynamic Constraint", ToolTip = "Add the particles to a spring constraint holding them together", Hidden),
201 //~~~
202 //256th entry
204};
205
206UENUM(BlueprintType)
208{
209 Integer_DynamicState UMETA(DisplayName = "Dynamic State", ToolTip = "Set the dynamic state of a particle (static, dynamic, kinematic...)"),
210 Integer_ActivateDisabled UMETA(DisplayName = "Activate Disabled", ToolTip = "Activate all the disabled particles for which the field value will be 0"),
211 Integer_CollisionGroup UMETA(DisplayName = "Collision Group", ToolTip = "Set the particles collision group."),
212 Integer_PositionAnimated UMETA(DisplayName = "Position Animated", ToolTip = "Add a position constraint to the particles to follow its kinematic position", Hidden),
213 Integer_PositionStatic UMETA(DisplayName = "Position Static", ToolTip = "Add a position constraint to the particles to remain static", Hidden),
214 //~~~
215 //256th entry
217};
218
220UENUM()
222{
223 /* Vector Field Type */
224 Field_Output_Vector UMETA(DisplayName = "Vector Field"),
225
226 /* Scalar Field Type */
227 Field_Output_Scalar UMETA(DisplayName = "Scalar Field"),
228
229 /* Integer field type */
230 Field_Output_Integer UMETA(DisplayName = "Integer Field"),
231
233};
234
235inline
237{
239 switch (OutputType)
240 {
242 {
243 PhysicsTypes = { EFieldPhysicsType::Field_LinearForce,
244 EFieldPhysicsType::Field_LinearVelocity,
245 EFieldPhysicsType::Field_AngularVelociy,
246 EFieldPhysicsType::Field_AngularTorque,
247 EFieldPhysicsType::Field_PositionTarget,
248 EFieldPhysicsType::Field_InitialLinearVelocity,
249 EFieldPhysicsType::Field_InitialAngularVelocity,
250 EFieldPhysicsType::Field_LinearImpulse };
251 break;
252 }
254 {
255 PhysicsTypes = { EFieldPhysicsType::Field_ExternalClusterStrain,
256 EFieldPhysicsType::Field_Kill,
257 EFieldPhysicsType::Field_DisableThreshold,
258 EFieldPhysicsType::Field_SleepingThreshold,
259 EFieldPhysicsType::Field_InternalClusterStrain,
260 EFieldPhysicsType::Field_DynamicConstraint };
261 break;
262 }
264 {
265 PhysicsTypes = { EFieldPhysicsType::Field_DynamicState,
266 EFieldPhysicsType::Field_ActivateDisabled,
267 EFieldPhysicsType::Field_CollisionGroup,
268 EFieldPhysicsType::Field_PositionAnimated,
269 EFieldPhysicsType::Field_PositionStatic };
270 break;
271 }
272 default:
273 break;
274 }
275 return MoveTemp(PhysicsTypes);
276}
277
278inline
282 const EFieldPhysicsType FieldTarget, int32& TargetIndex)
283{
284 EFieldOutputType OutputType = EFieldOutputType::Field_Output_Max;
285
286 TargetIndex = VectorTypes.Find(FieldTarget);
287 if (TargetIndex == INDEX_NONE)
288 {
289 TargetIndex = ScalarTypes.Find(FieldTarget);
290 if (TargetIndex == INDEX_NONE)
291 {
292 TargetIndex = IntegerTypes.Find(FieldTarget);
293 if (TargetIndex != INDEX_NONE)
294 {
295 OutputType = EFieldOutputType::Field_Output_Integer;
296 }
297 }
298 else
299 {
300 OutputType = EFieldOutputType::Field_Output_Scalar;
301 }
302 }
303 else
304 {
305 OutputType = EFieldOutputType::Field_Output_Vector;
306 }
307 return OutputType;
308}
309
310inline
312{
313 EFieldOutputType OutputType = EFieldOutputType::Field_Output_Max;
314
315 static const TArray<EFieldPhysicsType> VectorTypes = GetFieldTargetTypes(EFieldOutputType::Field_Output_Vector);
316 static const TArray<EFieldPhysicsType> ScalarTypes = GetFieldTargetTypes(EFieldOutputType::Field_Output_Scalar);
317 static const TArray<EFieldPhysicsType> IntegerTypes = GetFieldTargetTypes(EFieldOutputType::Field_Output_Integer);
318
319 int32 TargetIndex = INDEX_NONE;
320 return GetFieldTargetIndex(VectorTypes, ScalarTypes, IntegerTypes, FieldTarget, TargetIndex);
321}
322
323inline
325{
326 switch (Type)
327 {
328 case EFieldOutputType::Field_Output_Vector:
329 return "Vector";
330 case EFieldOutputType::Field_Output_Scalar:
331 return "Scalar";
332 case EFieldOutputType::Field_Output_Integer:
333 return "Integer";
334 }
335 return "None";
336}
337
339{
340 static const TArray<FName> FieldPhysicsNames =
341 { "Node", "DynamicState", "LinearForce", "ExternalClusterStrain", "Kill", "LinearVelocity", "AngularVelocity",
342 "AngularTorque", "InternalClusterStrain", "DisableThreshold", "SleepingThreshold", "PositionStatic",
343 "PositionAnimated", "PositionTarget", "DynamicConstraint", "CollisionGroup", "ActivateDisabled", "InitialLinearVelocity", "InitialAngularVelocity", "LinearImpulse"};
344
345 return FieldPhysicsNames;
346}
347
349{
350 static const TArray<EFieldPhysicsType> FieldPhysicsTypes ={ EFieldPhysicsType::Field_None,
351 EFieldPhysicsType::Field_DynamicState,
352 EFieldPhysicsType::Field_LinearForce,
353 EFieldPhysicsType::Field_ExternalClusterStrain,
354 EFieldPhysicsType::Field_Kill,
355 EFieldPhysicsType::Field_LinearVelocity,
356 EFieldPhysicsType::Field_AngularVelociy,
357 EFieldPhysicsType::Field_AngularTorque,
358 EFieldPhysicsType::Field_InternalClusterStrain,
359 EFieldPhysicsType::Field_DisableThreshold,
360 EFieldPhysicsType::Field_SleepingThreshold,
361 EFieldPhysicsType::Field_PositionStatic,
362 EFieldPhysicsType::Field_PositionAnimated,
363 EFieldPhysicsType::Field_PositionTarget,
364 EFieldPhysicsType::Field_DynamicConstraint,
365 EFieldPhysicsType::Field_CollisionGroup,
366 EFieldPhysicsType::Field_ActivateDisabled,
367 EFieldPhysicsType::Field_InitialLinearVelocity,
368 EFieldPhysicsType::Field_InitialAngularVelocity,
369 EFieldPhysicsType::Field_LinearImpulse };
370
371 return FieldPhysicsTypes;
372}
373
375{
377 static const FName NoneField("");
378
379 return (PhysicsType < FieldPhysicsNames.Num()) ? FieldPhysicsNames[PhysicsType] : NoneField;
380}
381
383{
386
387 return ((PhysicsIndex != INDEX_NONE) && (PhysicsIndex < EFieldPhysicsType::Field_PhysicsType_Max)) ?
388 (EFieldPhysicsType)PhysicsIndex : EFieldPhysicsType::Field_None;
389}
390
394UENUM(BlueprintType)
396{
397 Field_RadialIntMask UMETA(DisplayName = "RadialIntMask"),
398 Field_RadialFalloff UMETA(DisplayName = "RadialFalloff"),
399 Field_UniformVector UMETA(DisplayName = "UniformVector"),
400 Field_RadialVector UMETA(DisplayName = "RadialVector"),
401 Field_RadialVectorFalloff UMETA(DisplayName = "RadialVectorFalloff"),
402 //~~~
403 //256th entry
405};
406
407USTRUCT()
409{
411public:
412 static FName StaticType() { return FName("FFieldCollection"); }
414 {
415 AddGroup("VectorField");
416 AddAttribute<FVector3f>("Start", "VectorField");
417 AddAttribute<FVector3f>("End", "VectorField");
418 AddAttribute<FLinearColor>("Color", "VectorField");
419 }
420
422 {
423 int32 Size = AddElements(1, "VectorField");
424 ModifyAttribute<FVector3f>("Start", "VectorField")[Size] = Start;
425 ModifyAttribute<FVector3f>("End", "VectorField")[Size] = End;
426 ModifyAttribute<FLinearColor>("Color", "VectorField")[Size] = FLinearColor(0.6f, 0.6f, 0.6f);
427 return Size;
428 }
429
431 {
432 if (0 <= Index && Index < NumElements("VectorField"))
433 {
434 ModifyAttribute<FLinearColor>("Color", "VectorField")[Index] = Color;
435 }
436 }
437
439 {
441 if (FindAttribute<FVector3f>("Start", "VectorField") != nullptr && FindAttribute<FVector3f>("End", "VectorField") != nullptr)
442 {
445 for (int32 i = 0; i < NumElements("VectorField"); i++)
446 {
448 }
449 }
450 return VectorField;
451 }
452
454 {
455 if (FindAttribute<FLinearColor>("Color", "VectorField") != nullptr)
456 {
457 const TManagedArray<FLinearColor>& Color = GetAttribute<FLinearColor>("Color", "VectorField");
458 return Color.GetConstArray();
459 }
460 else
461 {
462 return TArray<FLinearColor>();
463 }
464 }
465
466};
467
468
@ INDEX_NONE
Definition CoreMiscDefines.h:150
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
EFieldObjectType
Definition FieldSystemTypes.h:103
EFieldCullingOperationType
Definition FieldSystemTypes.h:58
EFieldFalloffType
Definition FieldSystemTypes.h:132
EWaveFunctionType
Definition FieldSystemTypes.h:28
EFieldResolutionType
Definition FieldSystemTypes.h:72
const TArray< FName > & GetFieldPhysicsNames()
Definition FieldSystemTypes.h:338
const FName & GetFieldPhysicsName(EFieldPhysicsType PhysicsType)
Definition FieldSystemTypes.h:374
const TArray< EFieldPhysicsType > & GetFieldPhysicsTypes()
Definition FieldSystemTypes.h:348
EFieldIntegerType
Definition FieldSystemTypes.h:208
TArray< EFieldPhysicsType > GetFieldTargetTypes(EFieldOutputType OutputType)
Definition FieldSystemTypes.h:236
EFieldPhysicsType
Definition FieldSystemTypes.h:148
EFieldPhysicsType GetFieldPhysicsType(const FName &PhysicsName)
Definition FieldSystemTypes.h:382
FName GetFieldOutputName(const EFieldOutputType Type)
Definition FieldSystemTypes.h:324
EFieldOperationType
Definition FieldSystemTypes.h:43
EFieldScalarType
Definition FieldSystemTypes.h:194
EFieldPositionType
Definition FieldSystemTypes.h:119
EFieldOutputType GetFieldTargetOutput(const EFieldPhysicsType FieldTarget)
Definition FieldSystemTypes.h:311
EFieldVectorType
Definition FieldSystemTypes.h:177
EFieldFilterType
Definition FieldSystemTypes.h:86
EFieldOutputType GetFieldTargetIndex(const TArray< EFieldPhysicsType > &VectorTypes, const TArray< EFieldPhysicsType > &ScalarTypes, const TArray< EFieldPhysicsType > &IntegerTypes, const EFieldPhysicsType FieldTarget, int32 &TargetIndex)
Definition FieldSystemTypes.h:279
EFieldOutputType
Definition FieldSystemTypes.h:222
EFieldPhysicsDefaultFields
Definition FieldSystemTypes.h:396
@ UMETA
Definition FieldSystemTypes.h:15
ESetMaskConditionType
Definition FieldSystemTypes.h:14
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32 Size
Definition VulkanMemory.cpp:4034
Definition NameTypes.h:617
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition ManagedArray.h:1099
U16 Index
Definition radfft.cpp:71
Definition FieldSystemTypes.h:409
static FName StaticType()
Definition FieldSystemTypes.h:412
TArray< FLinearColor > GetVectorColor() const
Definition FieldSystemTypes.h:453
int32 AddVectorToField(FVector3f Start, FVector3f End)
Definition FieldSystemTypes.h:421
void SetColorOnVector(int32 Index, FLinearColor Color)
Definition FieldSystemTypes.h:430
FFieldCollection()
Definition FieldSystemTypes.h:413
TArray< TPair< FVector3f, FVector3f > > GetVectorField() const
Definition FieldSystemTypes.h:438
Definition Color.h:48
Definition ManagedArrayCollection.h:56
Definition Tuple.h:652