UPhysicsAsset

PhysicsAsset contains a set of rigid bodies and constraints that make up a single ragdoll.

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/PhysicsEngine/PhysicsAsset.h

Include

#include "PhysicsEngine/PhysicsAsset.h"

Syntax

class UPhysicsAsset :
    public UObject,
    public IInterface_PreviewMeshProvider

Remarks

PhysicsAsset contains a set of rigid bodies and constraints that make up a single ragdoll. The asset is not limited to human ragdolls, and can be used for any physical simulation using bodies and constraints. A SkeletalMesh has a single PhysicsAsset, which allows for easily turning ragdoll physics on or off for many SkeletalMeshComponents The asset can be configured inside the Physics Asset Editor.

Variables

Name Description

Public variable

uint8: 1

 

bNotForDedicatedServer

If true, we skip instancing bodies for this PhysicsAsset on dedicated servers

Public variable

TMap< FName, in...

 

BodySetupIndexMap

This caches the BodySetup Index by BodyName to speed up FindBodyIndex

Public variable

TArray< int32 >

 

BoundsBodies

Index of bodies that are marked bConsiderForBounds

Public variable

TMap< FRigidBod...

 

CollisionDisableTable

Table indicating which pairs of bodies have collision disabled between them.

Public variable

TArray< FName >

 

ConstraintProfiles

Public variable

TArray< TObject...

 

ConstraintSetup

Array of RB_ConstraintSetup objects.

Public variable

FName

 

CurrentConstraintProfileName

Public variable

FName

 

CurrentPhysicalAnimationProfileName

Public variable

TArray< FName >

 

PhysicalAnimationProfiles

Public variable

TSoftObjectPtr<...

 

PreviewSkeletalMesh

Public variable

TArray< TObject...

 

SkeletalBodySetups

Array of SkeletalBodySetup objects.

Public variable

FSolverIteratio...

 

SolverIterations

Old solver settings shown for reference.

Public variable

FPhysicsAssetSo...

 

SolverSettings

Solver settings when the asset is used with a RigidBody Anim Node (RBAN).

Public variable

EPhysicsAssetSo...

 

SolverType

Solver type used in physics asset editor.

Public variable

TObjectPtr< cla...

 

ThumbnailInfo

Information for thumbnail rendering

Constructors

Name Description

Public function

UPhysicsAsset

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

BodyFindConstraints

(
    int32 BodyIndex,
    TArray< int32 >& Constraints
)

Find all the constraints that are connected to a particular body.

Public function Const

FBox

 

CalcAABB

(
    const USkinnedMeshComponent* M...,
    const FTransform& LocalToWorld
)

Public function Const

bool

 

CanCalculateValidAABB

(
    const USkinnedMeshComponent* M...,
    const FTransform& LocalToWorld
)

Check if the Bounds can be calculate for the specified MeshComponent.

Public function

void

 

ClearAllPhysicsMeshes()

Clears physics meshes from all bodies

Public function Static

void

 

DeclareConstructClasses

(
    TArray< FTopLevelAssetPath >& OutC...,
    const UClass* SpecificSubclass
)

Public function

void

 

DisableCollision

(
    int32 BodyIndexA,
    int32 BodyIndexB
)

Disable collsion between the bodies specified by index.

Public function

void

 

DrawConstraints

(
    int32 ViewIndex,
    FMeshElementCollector& Collector,
    const FReferenceSkeleton& RefSkele...,
    const TArray< FTransform >& SpaceB...,
    const FTransform& LocalToWorld,
    float Scale
)

Public function

void

 

EnableCollision

(
    int32 BodyIndexA,
    int32 BodyIndexB
)

Enable collsion between the bodies specified by index.

Public function Const

int32

 

FindBodyIndex

(
    FName BodyName
)

Public function

FName

 

FindConstraintBoneName

(
    int32 ConstraintIndex
)

Public function

int32

 

FindConstraintIndex

(
    FName ConstraintName
)

Public function

int32

 

FindConstraintIndex

(
    FName Bone1Name,
    FName Bone2Name
)

Public function

int32

 

FindControllingBodyIndex

(
    USkeletalMesh* skelMesh,
    int32 BoneIndex
)

Find the index of the physics bone that is controlling this graphics bone.

Public function

int32

 

FindMirroredBone

(
    USkeletalMesh* skelMesh,
    int32 BoneIndex
)

Public function Const

int32

 

FindParentBodyIndex

(
    USkeletalMesh* skelMesh,
    int32 StartBoneIndex
)

Public function

void

 

GetBodyIndicesBelow

(
    TArray< int32 >& OutBodyIndices,
    FName InBoneName,
    USkeletalMesh* InSkelMesh,
    bool bIncludeParent
)

Utility for getting indices of all bodies below (and including) the one with the supplied name.

Public function

void

 

GetCollisionMesh

(
    int32 ViewIndex,
    FMeshElementCollector& Collector,
    const FReferenceSkeleton& RefSkele...,
    const TArray< FTransform >& SpaceB...,
    const FTransform& LocalToWorld,
    const FVector& Scale3D
)

Public function

FConstraintI...

 

GetConstraintByBoneNames

(
    FName Bone1Name,
    FName Bone2Name
)

Gets a constraint by its joint name

Public function

FConstraintI...

 

GetConstraintByName

(
    FName ConstraintName
)

Gets a constraint by its joint name

Public function

FConstraintI...

 

GetConstraintInstanceAccessorByIndex

(
    int32 Index
)

Public function

FConstraintI...

 

GetConstraintInstanceByIndex

(
    uint32 Index
)

Public function Const

const TArray...

 

GetConstraintProfileNames()

Public function

void

 

GetConstraints

(
    bool bIncludesTerminated,
    TArray< FConstraintInstanceAccessor...
)

Gets all constraints

Public function

void

 

GetNearestBodyIndicesBelow

(
    TArray< int32 >& OutBodyIndices,
    FName InBoneName,
    USkeletalMesh* InSkelMesh
)

Public function Const

const TArray...

 

GetPhysicalAnimationProfileNames()

Public function Const

ECollisionEn...

 

GetPrimitiveCollision

(
    int32 BodyIndex,
    EAggCollisionShape::Type PrimitiveT...,
    int32 PrimitiveIndex
)

Get the per-primitive collision filtering mode for a body.

Public function Const

bool

 

GetPrimitiveContributeToMass

(
    int32 BodyIndex,
    EAggCollisionShape::Type PrimitiveT...,
    int32 PrimitiveIndex
)

Get whether or not a primitive volume contributes to the mass of the object.

Public function

void

 

GetUsedMaterials

(
    TArray< UMaterialInterface* > ...
)

Public function

void

 

InvalidateAllPhysicsMeshes()

Invalidates physics meshes from all bodies. Data will be rebuilt completely.

Public function Const

bool

 

IsCollisionEnabled

(
    int32 BodyIndexA,
    int32 BodyIndexB
)

Check whether the two bodies specified are enabled for collision.

Public function Const

void

 

RefreshPhysicsAssetChange()

Update skeletal meshes when physics asset changes

Public function

void

 

SetPrimitiveCollision

(
    int32 BodyIndex,
    EAggCollisionShape::Type PrimitiveT...,
    int32 PrimitiveIndex,
    ECollisionEnabled::Type CollisionEn...
)

Get the per-primitive collision filtering mode for a body.

Public function

void

 

SetPrimitiveContributeToMass

(
    int32 BodyIndex,
    EAggCollisionShape::Type PrimitiveT...,
    int32 PrimitiveIndex,
    bool bContributesToMass
)

Set whether or not a primitive volume contributes to the mass of the object.

Public function

void

 

UpdateBodySetupIndexMap()

Update the BodySetup Array Index Map.

Public function

void

 

UpdateBoundsBodiesArray()

Update the BoundsBodies array and cache the indices of bodies marked with bConsiderForBounds to BoundsBodies array.

Overridden from UObject

Name Description

Public function Virtual Const

void

 

GetAssetRegistryTags

(
    TArray< FAssetRegistryTag >& OutTa...
)

Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects

Public function Virtual

FString

 

GetDesc()

Returns a one line description of an object for viewing in the thumbnail view of the generic browser

Public function Virtual

void

 

GetResourceSizeEx

(
    FResourceSizeEx& CumulativeResourc...
)

Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific).

Public function Virtual Const

EDataValidat...

 

IsDataValid

(
    FDataValidationContext& Context
)

Generic function to validate objects during changelist validations, etc.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostEditUndo()

Called after applying a transaction to the object.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

PreEditChange

(
    FProperty* PropertyAboutToChan...
)

This is called when a property is about to be modified externally

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Overridden from IInterface_PreviewMeshProvider

Name Description

Public function Virtual Const

USkeletalMes...

 

GetPreviewMesh()

Get the preview mesh for this asset

Public function Virtual

void

 

SetPreviewMesh

(
    USkeletalMesh* PreviewMesh,
    bool bMarkAsDirty
)

IPreviewMeshProviderInterface interface

Typedefs

Name

Description

FRefreshPhysicsAssetChangeDelegate

Delegate fired when physics asset changes

Constants

Name

Description

OnRefreshPhysicsAssetChange

Deprecated Variables

Name Description

Public variable

TObjectPtr< cla...

 

DefaultSkelMesh_DEPRECATED

Default skeletal mesh to use when previewing this PhysicsAsset etc.

See Also

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