Language:
Discover
By Skill Level
By Category

UBodySetup

Choose your OS:

Inheritance Hierarchy

Syntax

class UBodySetup : public UObject

Remarks

BodySetup contains all collision information that is associated with a single asset. A single BodySetup instance is shared among many BodyInstances so that geometry data is not duplicated. Assets typically implement a GetBodySetup function that is used during physics state creation.

Variables

Name Description

Public variable

FKAggregateGeom

 

AggGeom

Simplified collision representation of this

Public variable

uint8 : 1

 

bConsiderForBounds

Should this BodySetup be considered for the bounding box of the PhysicsAsset (and hence SkeletalMeshComponent).

Public variable

uint8 : 1

 

bCreatedPhysicsMeshes

Flag used to know if we have created the physics convex and tri meshes from the cooked data yet

Public variable

uint8 : 1

 

bDoubleSidedGeometry

If true, the physics triangle mesh will use double sided faces when doing scene queries.

Public variable

uint8 : 1

 

bFailedToCreatePhysicsMeshes

Flag used to know if we have failed to create physics meshes.

Public variable

uint8 : 1

 

bGenerateMirroredCollision

Should we generate data necessary to support collision on mirrored versions of this mesh.

Public variable

uint8 : 1

 

bGenerateNonMirroredCollision

Should we generate data necessary to support collision on normal (non-mirrored) versions of this body.

Public variable

uint8 : 1

 

bHasCookedCollisionData

Indicates whether this setup has any cooked collision data.

Public variable

uint8 : 1

 

bMeshCollideAll

If true, the physics of this mesh (only affects static meshes) will always contain ALL elements from the mesh - not just the ones enabled for collision.

Public variable

uint8 : 1

 

bNeverNeedsCookedCollisionData

Indicates that we will never use convex or trimesh shapes.

Public variable

FGuid

 

BodySetupGuid

GUID used to uniquely identify this setup so it can be found in the DDC

Public variable

FName

 

BoneName

Used in the PhysicsAsset case. Associates this Body with Bone in a skeletal mesh.

Public variable

uint8 : 1

 

bSharedCookedData

Whether the cooked data is shared by multiple body setups.

Public variable

FVector

 

BuildScale3D

Build scale for this body setup (static mesh settings define this value)

Public variable

TEnumAsByte < en...

 

CollisionReponse

Collision Type for this body. This eventually changes response to collision to others

Public variable

TEnumAsByte < en...

 

CollisionTraceFlag

Collision Trace behavior - by default, it will keep simple(convex)/complex(per-poly) separate

Public variable

FFormatContaine ...

 

CookedFormatData

Cooked physics data for each format

Public variable

FFormatContaine ...

 

CookedFormatDataOverride

Cooked physics data override.

Public variable

FPhysXCookHelpe ...

 

CurrentCookHelper

References the current async cook helper. Used to be able to abort a cook task

Public variable

FBodyInstance

 

DefaultInstance

Default properties of the body instance, copied into objects on instantiation, was URB_BodyInstance

Public variable

TEnumAsByte < EP ...

 

PhysicsType

If simulated it will use physics, if kinematic it will not be affected by physics, but can interact with physically simulated bodies.

Public variable

UPhysicalMateri ...

 

PhysMaterial

Physical material to use for simple collision on this body.

Public variable

TArray < physx::...

 

TriMeshes

Physics triangle mesh, created from cooked data in CreatePhysicsMeshes

Public variable

FBodySetupUVInf ...

 

UVInfo

Additional UV info, if available. Used for determining UV for a line trace impact.

Public variable

FWalkableSlopeO ...

 

WalkableSlopeOverride

Custom walkable slope setting for this body.

Constructors

Name Description

Public function

UBodySetup

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

AbortPhysicsMeshAsyncCreation()

Aborts an async cook that hasn't begun.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

AddCollisionFrom

(
    UBodySetup * FromSetup
)

Add collision shapes from another body setup to this one

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

AddCollisionFrom

(
    const FKAggregateGeom & FromAggGeom
)

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

AddShapesToRigidActor_AssumesLocked

(
    FBodyInstance * OwningInstance,
    EPhysicsSceneType SceneType,
    FVector & Scale3D,
    UPhysicalMaterial * SimpleMater...,
    TArray < UPhysicalMaterial * >&...,
    const FBodyCollisionData & BodyColl...,
    const FTransform & RelativeTM,
    TArray < FPhysicsShapeHandle >*...,
    bool bShapeSharing
)

WITH_EDITOR.

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3) f...

 

CalculateMass

(
    const UPrimitiveComponent * Com...
)

Calculates the mass.

Public function

bool

 

CalcUVAtLocation

(
    const FVector & BodySpaceLocation,
    int32 FaceIndex,
    int32 UVChannel,
    FVector2D & UV
)

Given a location in body space, and face index, find the UV of the desired UV channel.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

ClearPhysicsMeshes()

WITH_PHYSX.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

CopyBodyPropertiesFrom

(
    const UBodySetup * FromSetup
)

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

CopyBodySetupProperty

(
    const UBodySetup * Other
)

Copy all UPROPERTY settings except the collision geometry.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

CreateFromModel

(
    UModel * InModel,
    bool bRemoveExisting
)

Converts a UModel to a set of convex hulls for simplified collision.

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

CreatePhysicsMeshes()

Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX).

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

CreatePhysicsMeshesAsync

(
    FOnAsyncPhysicsCookFinished OnAsync...
)

WITH_PHYSX.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

FinishCreatingPhysicsMeshes

(
    const TArray < physx::PxConvexMesh&...,
    const TArray < physx::PxConvexMesh&...,
    const TArray < physx::PxTriangleMesh...
)

Finish creating the physics meshes and update the body setup data with cooked data

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3) f...

 

GetClosestPointAndNormal

(
    const FVector & WorldPosition,
    const FTransform & BodyToWorldTM,
    FVector & ClosestWorldPosition,
    FVector & FeatureNormal
)

Finds the closest point in the body setup.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)TE ...

 

GetCollisionTraceFlag()

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

GetCookInfo

(
    FCookBodySetupInfo & OutCookInfo,
    EPhysXMeshCookFlags InCookFlags
)

Generates the information needed for cooking geometry.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3) c...

 

GetPhysMaterial()

Returns the physics material used for this body.

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3) f...

 

GetShortestDistanceToPoint

(
    const FVector & WorldPosition,
    const FTransform & BodyToWorldTM
)

Finds the shortest distance between the body setup and a world position.

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3) f...

 

GetVolume

(
    const FVector & Scale
)

WITH_PHYSX.

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

InvalidatePhysicsData()

Invalidate physics data

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

RemoveSimpleCollision()

Clear all simple collision

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

RescaleSimpleCollision

(
    FVector BuildScale
)

Rescales simple collision geometry. Note you must recreate physics meshes after this

Public function

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

UpdateTriMeshVertices

(
    const TArray < FVector >& NewPositi...
)

Updates the tri mesh collision with new positions, and refits the BVH to match.

Overridden from UObject

Name Description

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

BeginCacheForCookedPlatformData

(
    const ITargetPlatform * TargetP...
)

Starts caching of platform specific data for the target platform Called when cooking before serialization so that object can prepare platform specific data Not called during normal loading of objects

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

[ENGINE_API](API\Runtime\Engine\GameFramework\ENGINE_API_3)vo...

 

ClearCachedCookedPlatformData

(
    const ITargetPlatform * TargetP...
)

Clears cached cooked platform data for specific platform

Public function Virtual

void

 

FinishDestroy()

Called to finish destroying the object.

Public function Virtual

void

 

GetResourceSizeEx

(
    FResourceSizeEx & CumulativeResourc...
)

WITH_EDITOR.

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

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object, and immediately after any undo/redo.

Public function Virtual

void

 

Serialize

(
    FArchive & Ar
)

UObject serializer.

See Also

GetBodySetup

FBodyInstance

References

Module

Engine

Header

Runtime/Engine/Classes/PhysicsEngine/BodySetup.h