Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/PhysicsEngine
Inheritance Hierarchy
References
| Module | Engine |
| Header | /Engine/Source/Runtime/Engine/Classes/PhysicsEngine/BodySetup.h |
| Include | #include "PhysicsEngine/BodySetup.h" |
Syntax
class UBodySetup : public UBodySetupCore
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
| Type | Name | Description | |
|---|---|---|---|
| FKAggregateGeom | AggGeom | Simplified collision representation of this | |
| uint8: 1 | bConsiderForBounds | Should this BodySetup be considered for the bounding box of the PhysicsAsset (and hence SkeletalMeshComponent). | |
| uint8: 1 | bCreatedPhysicsMeshes | Flag used to know if we have created the physics convex and tri meshes from the cooked data yet | |
| uint8: 1 | bDoubleSidedGeometry | If true, the physics triangle mesh will use double sided faces when doing scene queries. | |
| uint8: 1 | bFailedToCreatePhysicsMeshes | Flag used to know if we have failed to create physics meshes. | |
| uint8: 1 | bGenerateMirroredCollision | Should we generate data necessary to support collision on mirrored versions of this mesh. | |
| uint8: 1 | bGenerateNonMirroredCollision | Should we generate data necessary to support collision on normal (non-mirrored) versions of this body. | |
| uint8: 1 | bHasCookedCollisionData | Indicates whether this setup has any cooked collision data. | |
| 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. | |
| uint8: 1 | bNeverNeedsCookedCollisionData | Indicates that we will never use convex or trimesh shapes. | |
| FGuid | BodySetupGuid | GUID used to uniquely identify this setup so it can be found in the DDC | |
| uint8: 1 | bSharedCookedData | Whether the cooked data is shared by multiple body setups. | |
| uint8: 1 | bSupportUVsAndFaceRemap | If true, the physics triangle mesh will store UVs and the face remap table. | |
| FVector | BuildScale3D | Build scale for this body setup (static mesh settings define this value) | |
| TUniquePtr< FChaosDerivedDataReader< float, 3 > > | ChaosDerivedDataReader | Will contain deserialized data from the serialization function that can be used at PostLoad time. | |
| TArray< TSharedPtr< Chaos::FTriangleMeshImplicitObject, ESPMode::ThreadSafe > > | ChaosTriMeshes | FBodySetupTriMeshes* TriMeshWrapper;. | |
| FFormatContainer | CookedFormatData | Cooked physics data for each format | |
| FFormatContainer * | CookedFormatDataOverride | Cooked physics data override. | |
| FAsyncCookHelper * | CurrentCookHelper | ||
| FBodyInstance | DefaultInstance | Default properties of the body instance, copied into objects on instantiation, was URB_BodyInstance | |
| TArray< int32 > | FaceRemap | Additional face remap table, if available. | |
| TObjectPtr< class UPhysicalMaterial > | PhysMaterial | Physical material to use for simple collision on this body. | |
| FBodySetupUVInfo | UVInfo | Additional UV info, if available. Used for determining UV for a line trace impact. | |
| FWalkableSlopeOverride | WalkableSlopeOverride | Custom walkable slope setting for this body. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UBodySetup
(
const FObjectInitializer& ObjectInitializer |
|||
UBodySetup
(
FVTableHelper& Helper |
Needs implementation in BodySetup.cpp to compile UniquePtr for forward declared class |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~UBodySetup () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Aborts an async cook that hasn't begun. | ||
| bool | AddCollisionElemFrom
(
const FKAggregateGeom& FromAggGeom, |
||
| void | AddCollisionFrom
(
const FKAggregateGeom& FromAggGeom |
Add collision shapes from another body setup to this one | |
| void | AddCollisionFrom
(
UBodySetup* FromSetup |
Add collision shapes from another body setup to this one | |
| void | AddShapesToRigidActor_AssumesLocked
(
FBodyInstance* OwningInstance, |
Add the shapes defined by this body setup to the supplied PxRigidBody. | |
| float | CalculateMass
(
const UPrimitiveComponent* Component |
Calculates the mass. | |
| bool | CalcUVAtLocation
(
const FVector& BodySpaceLocation, |
Given a location in body space, and face index, find the UV of the desired UV channel. | |
| void | Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) | ||
| void | CopyBodyPropertiesFrom
(
const UBodySetup* FromSetup |
||
| void | CopyBodySetupProperty
(
const UBodySetup* Other |
Copy all UPROPERTY settings except the collision geometry. | |
| bool | CreateFromModel
(
UModel* InModel, |
Converts a UModel to a set of convex hulls for simplified collision. | |
| void | Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX). | ||
| 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). | |
| float | GetClosestPointAndNormal
(
const FVector& WorldPosition, |
Finds the closest point in the body setup. | |
| void | GetCookInfo
(
FCookBodySetupInfo& OutCookInfo, |
Generates the information needed for cooking geometry. | |
| void | GetGeometryDDCKey
(
FString& OutString |
Generate a string to uniquely describe the state of the geometry in this setup to populate the DDC | |
| UPhysicalMaterial * | Returns the physics material used for this body. | ||
| FVector::FReal | GetScaledVolume
(
const FVector& Scale |
Returns the volume of this element givent the scale | |
| float | GetShortestDistanceToPoint
(
const FVector& WorldPosition, |
Finds the shortest distance between the body setup and a world position. | |
| void | Invalidate physics data | ||
| void | Clear all simple collision | ||
| void | RescaleSimpleCollision
(
FVector BuildScale |
Rescales simple collision geometry. Note you must recreate physics meshes after this | |
| void | UpdateTriMeshVertices
(
const TArray< FVector >& NewPositions |
Updates the tri mesh collision with new positions, and refits the BVH to match. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginCacheForCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
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 | |
| void | BeginDestroy () |
Called before destroying the object. | |
| void | ClearCachedCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
Clears cached cooked platform data for specific platform | |
| void | Called to finish destroying the object. | ||
| void | GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
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). | |
| bool | IsCachedCookedPlatformDataLoaded
(
const ITargetPlatform* TargetPlatform |
Have we finished loading all the cooked platform data for the target platforms requested in BeginCacheForCookedPlatformData | |
| EDataValidationResult | IsDataValid
(
FDataValidationContext& Context |
Generic function to validate objects during changelist validations, etc. | |
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally | |
| void | PostEditUndo () |
Called after applying a transaction to the object. | |
| void | Called after the C++ constructor and after the properties have been initialized, including those loaded from config. | ||
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | Handles reading, writing, and reference collecting using FArchive. |
Typedefs
| Name | Description |
|---|---|
| FAsyncCookHelper | References the current async cook helper. Used to be able to abort a cook task |
Deprecated Variables
| Type | Name | Description | |
|---|---|---|---|
| uint8: 1 | bAlwaysFullAnimWeight_DEPRECATED | 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. | |
| float | BuildScale_DEPRECATED |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| float | GetVolume
(
const FVector& Scale |
Use GetScaledVolume which uses the same scaling technique as the generated collision geometry |
See Also
GetBodySetup