UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PerParticleEulerStepVelocity.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{
11{
12 public:
15
16 template<class T_PARTICLES>
17 inline void ApplyHelper(T_PARTICLES& InParticles, const FReal Dt, const int32 Index) const
18 {
19 InParticles.SetV(Index, InParticles.GetV(Index) + InParticles.Acceleration(Index) * Dt);
20 }
21
22 inline void Apply(FDynamicParticles& InParticles, const FReal Dt, const int32 Index) const override //-V762
23 {
24 if (InParticles.InvM(Index) == 0)
25 return;
27 }
28
29 inline void Apply(TRigidParticles<FReal, 3>& InParticles, const FReal Dt, const int32 Index) const override //-V762
30 {
31 if (InParticles.InvM(Index) == 0 || InParticles.Disabled(Index) || InParticles.Sleeping(Index))
32 return;
34
35 //
36 // TODO: This is the first-order approximation.
37 // If needed, we might eventually want to do a second order Euler's Equation,
38 // but if we do that we'll need to do a transform into a rotating reference frame.
39 // Just using W += InvI * (Torque - W x (I * W)) * dt is not correct, since Torque
40 // and W are in an inertial frame.
41 //
42 InParticles.SetW(Index, InParticles.GetW(Index) + InParticles.AngularAcceleration(Index) * Dt);
43 }
44
45 inline void Apply(TTransientPBDRigidParticleHandle<FReal, 3>& Particle, const FReal Dt) const override //-V762
46 {
47 Particle.SetV(Particle.GetV() + Particle.Acceleration() * Dt);
48 Particle.SetW(Particle.GetW() + Particle.AngularAcceleration() * Dt);
49 }
50};
51
52template<class T, int d>
53using TPerParticleEulerStepVelocity UE_DEPRECATED(4.27, "Deprecated. this class is to be deleted, use FPerParticleEulerStepVelocity instead") = FPerParticleEulerStepVelocity;
54
55}
#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 PerParticleEulerStepVelocity.h:11
void Apply(FDynamicParticles &InParticles, const FReal Dt, const int32 Index) const override
Definition PerParticleEulerStepVelocity.h:22
void Apply(TRigidParticles< FReal, 3 > &InParticles, const FReal Dt, const int32 Index) const override
Definition PerParticleEulerStepVelocity.h:29
FPerParticleEulerStepVelocity()
Definition PerParticleEulerStepVelocity.h:13
void Apply(TTransientPBDRigidParticleHandle< FReal, 3 > &Particle, const FReal Dt) const override
Definition PerParticleEulerStepVelocity.h:45
void ApplyHelper(T_PARTICLES &InParticles, const FReal Dt, const int32 Index) const
Definition PerParticleEulerStepVelocity.h:17
virtual ~FPerParticleEulerStepVelocity()
Definition PerParticleEulerStepVelocity.h:14
Definition PerParticleRule.h:18
Definition DynamicParticles.h:11
Definition ParticleHandle.h:987
Definition RigidParticles.h:78
Definition SkeletalMeshComponent.h:307
FRealDouble FReal
Definition Real.h:22
U16 Index
Definition radfft.cpp:71