Navigation
API > API/Runtime > API/Runtime/Chaos
Used by the constraint solver loop to cache all state for a particle and accumulate solver results. Uses a gather/scatter mechanism to read/write data to the particle SOAs at the beginning/end of the constraint solve. Constraint solver algorithms, and collision Update functions are implemented to use FSolverBody, and do not directly read/write to the particle handles. Constraint Solvers will modify P(), Q(), V() and W() via ApplyTransformDelta() and other methods.
There is one SolverBody for each particle in an island. Most constraint solvers will actually wrap the FSolverBody in FConstraintSolverBody, which allows us to apply per-constraint modifiers to the Solver Body.
the X(), P(), R(), Q() accessors on FSolverBody return the Center of Mass positions and rotations, in contrast to the Particle methods which gives Actor positions and rotations. This is because the Constraint Solvers all calculate impulses and position corrections relative to the center of mass.
| Name | FSolverBody |
| Type | class |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Evolution/SolverBody.h |
| Include Path | #include "Chaos/Evolution/SolverBody.h" |
Syntax
class FSolverBody
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSolverBody() |
Create an empty solver body. All properties are uninitialized. | Chaos/Evolution/SolverBody.h |
Structs
| Name | Remarks |
|---|---|
| FState | The struct exists only so that we can use the variable names as accessor names without violation the variable naming convention |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| State | FState | Chaos/Evolution/SolverBody.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FVec3 ActorP() |
Get the world-space Actor position. | Chaos/Evolution/SolverBody.h | |
FRotation3 ActorQ() |
Get the world-space Actor rotation. | Chaos/Evolution/SolverBody.h | |
void ApplyAngularVelocityDelta
(
const FSolverVec3& DW |
Apply an world-space angular velocity delta to the solver body. | Chaos/Evolution/SolverBody.h | |
void ApplyCorrections() |
Apply the accumulated position and rotation corrections to the predicted P and Q This is only used by unit tests that reuse solver bodies between ticks. | Chaos/Evolution/SolverBody.h | |
void ApplyLinearVelocityDelta
(
const FSolverVec3& DV |
Apply a world-space linear velocity delta to the solver body. | Chaos/Evolution/SolverBody.h | |
void ApplyPositionCorrectionDelta
(
const FSolverVec3& CP |
Apply a world-space position correction delta to the solver body center of mass This will translate the body without introducing linear velocity. | Chaos/Evolution/SolverBody.h | |
void ApplyPositionDelta
(
const FSolverVec3& DP |
Apply a world-space position delta to the solver body center of mass. | Chaos/Evolution/SolverBody.h | |
void ApplyRotationCorrectionDelta
(
const FSolverVec3& CR |
Apply a world-space rotation correction delta to the solver body This will rotate the body without introducing angular velocity. | Chaos/Evolution/SolverBody.h | |
void ApplyRotationDelta
(
const FSolverVec3& DR |
Apply a world-space rotation delta to the solver body and update the inverse mass. | Chaos/Evolution/SolverBody.h | |
void ApplyTransformDelta
(
const FSolverVec3& DP, |
Apply a world-space position and rotation delta to the body center of mass, and update inverse mass. | Chaos/Evolution/SolverBody.h | |
void ApplyVelocityDelta
(
const FSolverVec3& DV, |
Apply a world-space velocity delta to the solver body. | Chaos/Evolution/SolverBody.h | |
const FVec3 & CoM() |
Chaos/Evolution/SolverBody.h | ||
FRigidTransform3 CoMTransform() |
The current CoM transform. | Chaos/Evolution/SolverBody.h | |
FVec3 CorrectedActorP () |
Get the current world-space Actor position. | Chaos/Evolution/SolverBody.h | |
FRotation3 CorrectedActorQ () |
Get the current world-space Actor rotation. | Chaos/Evolution/SolverBody.h | |
FVec3 CorrectedP () |
World-space position after applying the net correction DP() | Chaos/Evolution/SolverBody.h | |
FRotation3 CorrectedQ () |
World-space rotation after applying the net correction DQ() | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & CP () |
Net world-space position correction applied by the constraints. | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & CQ() |
Net world-space rotation correction applied by the constraints (axis-angle vector equivalent to angular velocity but for position) | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & DP() |
Net world-space position displacement applied by the constraints. | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & DQ() |
Net world-space rotation displacement applied by the constraints (axis-angle vector equivalent to angular velocity but for position) | Chaos/Evolution/SolverBody.h | |
void EnforceShortestRotationTo
(
const FRotation3& InQ |
Update the rotation to be in the same hemisphere as the provided quaternion. This is used by joints with angular constraint/drives. | Chaos/Evolution/SolverBody.h | |
const FSolverMatrix33 & InvI() |
Get the world-space inverse inertia. | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & InvILocal() |
Get the local-space inverse inertia (diagonal elements) | Chaos/Evolution/SolverBody.h | |
FSolverReal InvM () |
Get the inverse mass. | Chaos/Evolution/SolverBody.h | |
bool IsDynamic () |
Whether the body has a finite mass. | Chaos/Evolution/SolverBody.h | |
int32 Level() |
Contact graph level. This is used in shock propagation to determine which of two bodies should have its inverse mass scaled. | Chaos/Evolution/SolverBody.h | |
const FVec3 & P () |
Predicted (post-integrate) world-space center of mass position. | Chaos/Evolution/SolverBody.h | |
void PrefetchPositionSolverData() |
Chaos/Evolution/SolverBody.h | ||
void PrefetchVelocitySolverData() |
Chaos/Evolution/SolverBody.h | ||
const FRotation3 & Q () |
Predicted (post-integrate) world-space center of mass rotation. | Chaos/Evolution/SolverBody.h | |
const FRotation3 & R() |
Pre-integration world-space center of mass rotation. | Chaos/Evolution/SolverBody.h | |
void Reset() |
Reset the solver accumulators | Chaos/Evolution/SolverBody.h | |
const FRotation3 & RoM() |
Chaos/Evolution/SolverBody.h | ||
void SetCoM
(
const FVec3& InCoM |
Chaos/Evolution/SolverBody.h | ||
void SetDP
(
const FSolverVec3& InDP |
Chaos/Evolution/SolverBody.h | ||
void SetDQ
(
const FSolverVec3& InDQ |
Chaos/Evolution/SolverBody.h | ||
void SetImplicitVelocity
(
FReal Dt |
Calculate and set the velocity and angular velocity from the net transform delta. | Chaos/Evolution/SolverBody.h | |
void SetInvI
(
const FMatrix33& InInvI |
Set the world-space inverse inertia. | Chaos/Evolution/SolverBody.h | |
void SetInvILocal
(
const FVec3& InInvILocal |
Set the local-space inverse inertia (diagonal elements) | Chaos/Evolution/SolverBody.h | |
void SetInvM
(
FReal InInvM |
Set the inverse mass. | Chaos/Evolution/SolverBody.h | |
void SetLevel
(
int32 InLevel |
Chaos/Evolution/SolverBody.h | ||
void SetP
(
const FVec3& InP |
Chaos/Evolution/SolverBody.h | ||
void SetQ
(
const FRotation3& InQ |
Chaos/Evolution/SolverBody.h | ||
void SetR
(
const FRotation3& InR |
Chaos/Evolution/SolverBody.h | ||
void SetRoM
(
const FRotation3& InRoM |
Chaos/Evolution/SolverBody.h | ||
void SetV
(
const FVec3& InV |
Chaos/Evolution/SolverBody.h | ||
void SetW
(
const FVec3& InW |
Chaos/Evolution/SolverBody.h | ||
void SetX
(
const FVec3& InX |
Chaos/Evolution/SolverBody.h | ||
void UpdateRotationDependentState() |
Update cached state that depends on rotation (i.e., world space inertia) | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & V() |
World-space center of mass velocity. | Chaos/Evolution/SolverBody.h | |
const FSolverVec3 & W() |
World-space center of mass angular velocity. | Chaos/Evolution/SolverBody.h | |
const FVec3 & X() |
Pre-integration world-space center of mass position. | Chaos/Evolution/SolverBody.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FSolverBody MakeInitialized () |
A factory method to create a safely initialized Solverbody. | Chaos/Evolution/SolverBody.h | |
static FSolverBody MakeUninitialized() |
Create an empty solver body. All properties are uninitialized. | Chaos/Evolution/SolverBody.h | |
static FSolverReal ZeroMassThreshold() |
Chaos/Evolution/SolverBody.h |