Navigation
API > API/Runtime > API/Runtime/Engine
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.
| Name | UBodySetup |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/PhysicsEngine/BodySetup.h |
| Include Path | #include "PhysicsEngine/BodySetup.h" |
Syntax
UCLASS (CollapseCategories, MinimalAPI)
class UBodySetup : public UBodySetupCore
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UBodySetupCore → UBodySetup
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UBodySetup
(
FVTableHelper& Helper |
Needs implementation in BodySetup.cpp to compile UniquePtr for forward declared class | PhysicsEngine/BodySetup.h | |
UBodySetup
(
const FObjectInitializer& ObjectInitializer |
PhysicsEngine/BodySetup.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~UBodySetup() |
PhysicsEngine/BodySetup.h |
Structs
| Name | Remarks |
|---|---|
| FBodySetupTryCookResult |
Enums
Public
| Name | Remarks |
|---|---|
| EBodySetupCookResult |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FAsyncCookHelper | Chaos::FCookHelper | References the current async cook helper. Used to be able to abort a cook task | PhysicsEngine/BodySetup.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AggGeom | FKAggregateGeom | Simplified collision representation of this | PhysicsEngine/BodySetup.h |
|
| bConsiderForBounds | uint8 | Should this BodySetup be considered for the bounding box of the PhysicsAsset (and hence SkeletalMeshComponent). | PhysicsEngine/BodySetup.h |
|
| bCreatedPhysicsMeshes | uint8 | Flag used to know if we have created the physics convex and tri meshes from the cooked data yet | PhysicsEngine/BodySetup.h | |
| bDoubleSidedGeometry | uint8 | If true, the physics triangle mesh will use double sided faces when doing scene queries. | PhysicsEngine/BodySetup.h |
|
| bFailedToCreatePhysicsMeshes | uint8 | Flag used to know if we have failed to create physics meshes. | PhysicsEngine/BodySetup.h | |
| bGenerateMirroredCollision | uint8 | Should we generate data necessary to support collision on mirrored versions of this mesh. | PhysicsEngine/BodySetup.h | |
| bGenerateNonMirroredCollision | uint8 | Should we generate data necessary to support collision on normal (non-mirrored) versions of this body. | PhysicsEngine/BodySetup.h | |
| bHasCookedCollisionData | uint8 | Indicates whether this setup has any cooked collision data. | PhysicsEngine/BodySetup.h | |
| bMeshCollideAll | uint8 | 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. | PhysicsEngine/BodySetup.h |
|
| bNeverNeedsCookedCollisionData | uint8 | Indicates that we will never use convex or trimesh shapes. | PhysicsEngine/BodySetup.h |
|
| BodySetupGuid | FGuid | GUID used to uniquely identify this setup so it can be found in the DDC | PhysicsEngine/BodySetup.h | |
| bSharedCookedData | uint8 | Whether the cooked data is shared by multiple body setups. | PhysicsEngine/BodySetup.h | |
| bSupportUVsAndFaceRemap | uint8 | If true, the physics triangle mesh will store UVs and the face remap table. | PhysicsEngine/BodySetup.h | |
| BuildScale3D | FVector | Build scale for this body setup (static mesh settings define this value) | PhysicsEngine/BodySetup.h | |
| ChaosDerivedDataReader | TUniquePtr< FChaosDerivedDataReader< float, 3 > > | Will contain deserialized data from the serialization function that can be used at PostLoad time. | PhysicsEngine/BodySetup.h | |
| ChaosTriMeshes | TArray< TSharedPtr< Chaos::FTriangleMeshImplicitObject, ESPMode::ThreadSafe > > | PhysicsEngine/BodySetup.h | ||
| CookedFormatData | FFormatContainer | Cooked physics data for each format | PhysicsEngine/BodySetup.h | |
| CookedFormatDataMutex | FCriticalSection | The format container may be queried from multiple threads and mutated if a thread fails to find a format. | PhysicsEngine/BodySetup.h | |
| CookedFormatDataOverride | FFormatContainer * | Cooked physics data override. | PhysicsEngine/BodySetup.h | |
| CurrentCookHelper | FAsyncCookHelper * | PhysicsEngine/BodySetup.h | ||
| DefaultInstance | FBodyInstance | Default properties of the body instance, copied into objects on instantiation, was URB_BodyInstance | PhysicsEngine/BodySetup.h |
|
| FaceRemap | TArray< int32 > | Additional face remap table, if available. | PhysicsEngine/BodySetup.h | |
| PhysMaterial | TObjectPtr< class UPhysicalMaterial > | Physical material to use for simple collision on this body. | PhysicsEngine/BodySetup.h |
|
| TriMeshGeometries | TArray< Chaos::FTriangleMeshImplicitObjectPtr > | List of chaos trimesh objects | PhysicsEngine/BodySetup.h | |
| UVInfo | FBodySetupUVInfo | Additional UV info, if available. Used for determining UV for a line trace impact. | PhysicsEngine/BodySetup.h | |
| WalkableSlopeOverride | FWalkableSlopeOverride | Custom walkable slope setting for this body. | PhysicsEngine/BodySetup.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AbortPhysicsMeshAsyncCreation () |
Aborts an async cook that hasn't begun. | PhysicsEngine/BodySetup.h | |
bool AddCollisionElemFrom
(
const FKAggregateGeom& FromAggGeom, |
PhysicsEngine/BodySetup.h | ||
void AddCollisionFrom
(
const FKAggregateGeom& FromAggGeom |
PhysicsEngine/BodySetup.h | ||
void AddCollisionFrom
(
UBodySetup* FromSetup |
Add collision shapes from another body setup to this one | PhysicsEngine/BodySetup.h | |
void AddShapesToRigidActor_AssumesLocked
(
FBodyInstance* OwningInstance, |
Add the shapes defined by this body setup to the supplied PxRigidBody. | PhysicsEngine/BodySetup.h | |
virtual float CalculateMass
(
const UPrimitiveComponent* Component |
Calculates the mass. | PhysicsEngine/BodySetup.h | |
bool CalcUVAtLocation
(
const FVector& BodySpaceLocation, |
Given a location in body space, and face index, find the UV of the desired UV channel. | PhysicsEngine/BodySetup.h | |
void ClearPhysicsMeshes() |
Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) | PhysicsEngine/BodySetup.h | |
void CopyBodyPropertiesFrom
(
const UBodySetup* FromSetup |
PhysicsEngine/BodySetup.h | ||
virtual void CopyBodySetupProperty
(
const UBodySetup* Other |
Copy all UPROPERTY settings except the collision geometry. | PhysicsEngine/BodySetup.h | |
bool CreateFromModel
(
UModel* InModel, |
Converts a UModel to a set of convex hulls for simplified collision. | PhysicsEngine/BodySetup.h | |
virtual void CreatePhysicsMeshes () |
Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX). | PhysicsEngine/BodySetup.h | |
void CreatePhysicsMeshesAsync
(
FOnAsyncPhysicsCookFinished OnAsyncPhysicsCookFinished |
Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data async (useful for runtime cooking as it can go wide off the game thread) Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX). | PhysicsEngine/BodySetup.h | |
float GetClosestPointAndNormal
(
const FVector& WorldPosition, |
Finds the closest point in the body setup. | PhysicsEngine/BodySetup.h | |
void GetCookInfo
(
FCookBodySetupInfo& OutCookInfo, |
Generates the information needed for cooking geometry. | PhysicsEngine/BodySetup.h | |
void GetGeometryDDCKey
(
FString& OutString |
Generate a string to uniquely describe the state of the geometry in this setup to populate the DDC | PhysicsEngine/BodySetup.h | |
| Returns the physics material used for this body. | PhysicsEngine/BodySetup.h | ||
virtual FVector::FReal GetScaledVolume
(
const FVector& Scale |
Returns the volume of this element givent the scale | PhysicsEngine/BodySetup.h | |
float GetShortestDistanceToPoint
(
const FVector& WorldPosition, |
Finds the shortest distance between the body setup and a world position. | PhysicsEngine/BodySetup.h | |
virtual float GetVolume
(
const FVector& Scale |
Returns the volume of this element | PhysicsEngine/BodySetup.h | |
virtual void InvalidatePhysicsData() |
Invalidate physics data | PhysicsEngine/BodySetup.h | |
void RemoveSimpleCollision() |
Clear all simple collision | PhysicsEngine/BodySetup.h | |
void RescaleSimpleCollision
(
FVector BuildScale |
Rescales simple collision geometry. Note you must recreate physics meshes after this | PhysicsEngine/BodySetup.h | |
void UpdateTriMeshVertices
(
const TArray< FVector >& NewPositions |
Updates the tri mesh collision with new positions, and refits the BVH to match. | PhysicsEngine/BodySetup.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginCacheForCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
PhysicsEngine/BodySetup.h | ||
virtual void BeginDestroy() |
PhysicsEngine/BodySetup.h | ||
virtual void ClearCachedCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
PhysicsEngine/BodySetup.h | ||
virtual void FinishDestroy() |
PhysicsEngine/BodySetup.h | ||
virtual void GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
PhysicsEngine/BodySetup.h | ||
virtual bool IsCachedCookedPlatformDataLoaded
(
const ITargetPlatform* TargetPlatform |
PhysicsEngine/BodySetup.h | ||
virtual EDataValidationResult IsDataValid
(
FDataValidationContext& Context |
PhysicsEngine/BodySetup.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
PhysicsEngine/BodySetup.h | ||
virtual void PostEditUndo() |
PhysicsEngine/BodySetup.h | ||
virtual void PostInitProperties() |
PhysicsEngine/BodySetup.h | ||
virtual void PostLoad() |
PhysicsEngine/BodySetup.h | ||
virtual void Serialize
(
FArchive& Ar |
PhysicsEngine/BodySetup.h |
Deprecated Variables
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bAlwaysFullAnimWeight_DEPRECATED | uint8 | If true (and bEnableFullAnimWeightBodies in SkelMeshComp is true), the physics of this bone will always be blended into the skeletal mesh, regardless of what PhysicsWeight of the SkelMeshComp is. | PhysicsEngine/BodySetup.h | |
| BuildScale_DEPRECATED | float | PhysicsEngine/BodySetup.h |
See Also
-
GetBodySetup