FAnimPhys

Lightweight rigid body motion solver (no collision) used for cosmetic secondary motion in an animation graph without invoking something heavier like using PhysX to simulate constraints which could be cost prohibitive

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/Animation/AnimPhysicsSolver.h

Include

#include "Animation/AnimPhysicsSolver.h"

Syntax

class FAnimPhys

Remarks

Lightweight rigid body motion solver (no collision) used for cosmetic secondary motion in an animation graph without invoking something heavier like using PhysX to simulate constraints which could be cost prohibitive

Functions

Name Description

Public function Static

void

 

ApplyImpulse

(
    FAnimPhysRigidBody* InOutRigid...,
    const FVector& InWorldOrientedImpa...,
    const FVector& InImpulse
)

Apply an impulse to a body

Public function Static

FVector

 

CalculateCenterOfMass

(
    const TArray< FVector >& InVertice...,
    const TArray< FIntVector >& InTria...
)

Calculates the center of mass of a shape

Public function Static

FVector

 

CalculateCenterOfMass

(
    const TArray< FAnimPhysShape >& In...
)

Calculates the centre of mass of a collection of shapes

Public function Static

FMatrix

 

CalculateInertia

(
    const TArray< FVector >& InVertice...,
    const TArray< FIntVector >& InTria...,
    const FVector& InCenterOfMass
)

Calculate the inertia tensor of a shape

Public function Static

FMatrix

 

CalculateInertia

(
    const TArray< FAnimPhysShape >& In...,
    const FVector& InCenterOfMass
)

Calculate the inertia tensor of a collection of shapes

Public function Static

float

 

CalculateVolume

(
    const TArray< FAnimPhysShape >& In...
)

Calculates the volume of a collection of shapes

Public function Static

float

 

CalculateVolume

(
    const TArray< FVector >& InVertice...,
    const TArray< FIntVector >& InTria...
)

Calculates the volume of a shape

Public function Static

void

 

ConstrainAlongDirection

(
    float DeltaTime,
    TArray< FAnimPhysLinearLimit >& Li...,
    FAnimPhysRigidBody* FirstBody,
    const FVector& FirstPosition,
    FAnimPhysRigidBody* SecondBody,
    const FVector& SecondPosition,
    const FVector& AxisToConstrain,
    const FVector2D Limits,
    float MinimumForce,
    float MaximumForce
)

Constrain bodies along a provided axis

Public function Static

void

 

ConstrainAngularRange

(
    float DeltaTime,
    TArray< FAnimPhysAngularLimit >& L...,
    FAnimPhysRigidBody* FirstBody,
    FAnimPhysRigidBody* SecondBody,
    const FQuat& JointFrame,
    AnimPhysTwistAxis TwistAxis,
    const FVector& JointLimitMin,
    const FVector& JointLimitMax,
    float InJointBias
)

Constraint two bodies together with angular limits, limiting the relative rotation between them.

Public function Static

void

 

ConstrainConeAngle

(
    float DeltaTime,
    TArray< FAnimPhysAngularLimit >& L...,
    FAnimPhysRigidBody* FirstBody,
    const FVector& Normal0,
    FAnimPhysRigidBody* SecondBody,
    const FVector& Normal1,
    float LimitAngle,
    float InJointBias
)

Constraints the rotation between two bodies into a cone

Public function Static

void

 

ConstrainPlanar

(
    float DeltaTime,
    TArray< FAnimPhysLinearLimit >& Li...,
    FAnimPhysRigidBody* Body,
    const FTransform& PlaneTransform
)

Constrains the position of a body to one side of a plane placed at PlaneTransform (plane normal is Z axis)

Public function Static

void

 

ConstrainPositionNailed

(
    float DeltaTime,
    TArray< FAnimPhysLinearLimit >& Li...,
    FAnimPhysRigidBody* FirstBody,
    const FVector& FirstPosition,
    FAnimPhysRigidBody* SecondBody,
    const FVector& SecondPosition
)

Constrain bodies together as if fixed or nailed (linear only, bodies can still rotate)

Public function Static

void

 

ConstrainPositionPrismatic

(
    float DeltaTime,
    TArray< FAnimPhysLinearLimit >& Li...,
    FAnimPhysRigidBody* FirstBody,
    const FVector& FirstPosition,
    FAnimPhysRigidBody* SecondBody,
    const FVector& SecondPosition,
    const FQuat& PrismRotation,
    const FVector& LimitsMin,
    const FVector& LimitsMax
)

Constrain bodies together with linear limits forming a box or prism around the constraint

Public function Static

void

 

ConstrainSphericalInner

(
    float DeltaTime,
    TArray< FAnimPhysLinearLimit >& Li...,
    FAnimPhysRigidBody* Body,
    const FTransform& SphereTransform,
    float SphereRadius
)

Constrains the position of a body within the requested sphere

Public function Static

void

 

ConstrainSphericalOuter

(
    float DeltaTime,
    TArray< FAnimPhysLinearLimit >& Li...,
    FAnimPhysRigidBody* Body,
    const FTransform& SphereTransform,
    float SphereRadius
)

Constrains the position of a body outside of the requested sphere

Public function Static

void

 

CreateSpring

(
    TArray< FAnimPhysSpring >& SpringC...,
    FAnimPhysRigidBody* Body0,
    FVector Position0,
    FAnimPhysRigidBody* Body1,
    FVector Position1
)

Spring creation methods.

Public function Static

void

 

PhysicsUpdate

(
    float DeltaTime,
    TArray< FAnimPhysRigidBody* > ...,
    TArray< FAnimPhysLinearLimit >& Li...,
    TArray< FAnimPhysAngularLimit >& A...,
    TArray< FAnimPhysSpring >& Springs,
    const FVector& GravityDirection,
    const FVector& ExternalForce,
    const FVector& ExternalLinearAcc,
    int32 NumPreIterations,
    int32 NumPostIterations
)

Performs a physics update on the provided state objects

Public function Static

void

 

ScaleRigidBodyMass

(
    FAnimPhysRigidBody* InOutRigid...,
    float Scale
)

Scale the mass and inertia properties of a rigid body

Constants

Name

Description

bEnableDetailedStats

Runtime cvar toggle for detailed/verbose profiling.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss