UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PerParticleEtherDrag.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
6#include "Chaos/Utilities.h"
7
8namespace Chaos
9{
12
14 {
15 public:
18
20 {
21 const FReal LinearDrag = LinearEtherDragOverride >= 0 ? LinearEtherDragOverride : LinearDamp * Dt;
22 const FReal LinearMultiplier = FMath::Max(FReal(0), FReal(1) - LinearDrag);
24
26 const FReal AngularMultiplier = FMath::Max(FReal(0), FReal(1) - AngularDrag);
28
29 const FReal LinearSpeedSq = V.SizeSquared();
30 const FReal AngularSpeedSq = W.SizeSquared();
31
33 {
34 V *= FMath::Sqrt(LinearLimitSq / LinearSpeedSq);
35 }
36
38 {
39 W *= FMath::Sqrt(AngularLimitSq / AngularSpeedSq);
40 }
41 }
42
43 inline void Apply(FDynamicParticles& InParticles, const FReal Dt, const int32 Index) const override //-V762
44 {
45 ensure(false);
46 }
47
48 inline void Apply(TRigidParticles<FReal, 3>& InParticles, const FReal Dt, const int32 Index) const override //-V762
49 {
50 FVec3 V = InParticles.GetV(Index);
51 FVec3 W = InParticles.GetW(Index);
52 ApplyHelper(V, W, InParticles.LinearEtherDrag(Index), InParticles.AngularEtherDrag(Index), InParticles.MaxLinearSpeedSq(Index), InParticles.MaxAngularSpeedSq(Index), Dt);
53 InParticles.SetV(Index, V);
54 InParticles.SetW(Index, W);
55 }
56
57 inline void Apply(TTransientPBDRigidParticleHandle<FReal, 3>& Particle, const FReal Dt) const override //-V762
58 {
59 FVec3 V = Particle.GetV();
60 FVec3 W = Particle.GetW();
61 ApplyHelper(V, W, Particle.LinearEtherDrag(), Particle.AngularEtherDrag(), Particle.MaxLinearSpeedSq(), Particle.MaxAngularSpeedSq(), Dt);
62 Particle.SetV(V);
63 Particle.SetW(W);
64 }
65 };
66
67 template<class T, int d>
68 using TPerParticleEtherDrag UE_DEPRECATED(4.27, "Deprecated. this class is to be deleted, use FPerParticleEtherDrag instead") = FPerParticleEtherDrag;
69}
#define ensure( InExpression)
Definition AssertionMacros.h:464
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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
Definition PerParticleEtherDrag.h:14
void Apply(TTransientPBDRigidParticleHandle< FReal, 3 > &Particle, const FReal Dt) const override
Definition PerParticleEtherDrag.h:57
void Apply(TRigidParticles< FReal, 3 > &InParticles, const FReal Dt, const int32 Index) const override
Definition PerParticleEtherDrag.h:48
void ApplyHelper(FVec3 &V, FVec3 &W, FReal LinearDamp, FReal AngularDamp, FReal LinearLimitSq, FReal AngularLimitSq, FReal Dt) const
Definition PerParticleEtherDrag.h:19
void Apply(FDynamicParticles &InParticles, const FReal Dt, const int32 Index) const override
Definition PerParticleEtherDrag.h:43
FPerParticleEtherDrag()
Definition PerParticleEtherDrag.h:16
virtual ~FPerParticleEtherDrag()
Definition PerParticleEtherDrag.h:17
Definition PerParticleRule.h:18
Definition DynamicParticles.h:11
Definition ParticleHandle.h:987
Definition RigidParticles.h:78
Definition SkeletalMeshComponent.h:307
FRealSingle LinearEtherDragOverride
Definition PerParticleEtherDrag.cpp:9
FRealDouble FReal
Definition Real.h:22
float FRealSingle
Definition Real.h:14
FRealSingle AngularEtherDragOverride
Definition PerParticleEtherDrag.cpp:12
U16 Index
Definition radfft.cpp:71