UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PBDCollisionSolverUtilities.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Chaos/Core.h"
5#include "Chaos/Defines.h"
7
8
9namespace Chaos
10{
11 namespace Private
12 {
13
15 const FSolverBody& Body0,
16 const FSolverBody& Body1,
17 const FSolverReal ShockPropagation,
20 {
23
24 // Shock propagation decreases the inverse mass of bodies that are lower in the pile
25 // of objects. This significantly improves stability of heaps and stacks. Height in the pile is indictaed by the "level".
26 // No need to set an inverse mass scale if the other body is kinematic (with inv mass of 0).
27 // Bodies at the same level do not take part in shock propagation.
28 if (Body0.IsDynamic() && Body1.IsDynamic() && (Body0.Level() != Body1.Level()))
29 {
30 // Set the inv mass scale of the "lower" body to make it heavier
31 if (Body0.Level() < Body1.Level())
32 {
33 OutShockPropagation0 = ShockPropagation;
34 }
35 else
36 {
37 OutShockPropagation1 = ShockPropagation;
38 }
39 return true;
40 }
41
42 return false;
43 }
44
45 } // namespace Private
46} // namespace Chaos
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition SolverBody.h:99
int32 Level() const
Contact graph level. This is used in shock propagation to determine which of two bodies should have i...
Definition SolverBody.h:330
bool IsDynamic() const
Whether the body has a finite mass.
Definition SolverBody.h:337
bool CalculateBodyShockPropagation(const FSolverBody &Body0, const FSolverBody &Body1, const FSolverReal ShockPropagation, FSolverReal &OutShockPropagation0, FSolverReal &OutShockPropagation1)
Definition PBDCollisionSolverUtilities.h:14
Definition SkeletalMeshComponent.h:307
FRealSingle FSolverReal
Definition SolverBody.h:38
Definition OverriddenPropertySet.cpp:45