UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FBodyInstance Struct Reference

#include <BodyInstance.h>

+ Inheritance diagram for FBodyInstance:

Classes

struct  FAsyncTermBodyPayload
 
struct  FWeldInfo
 

Public Member Functions

float GetSolverAsyncDeltaTime () const
 
bool IsSolverAsyncDeltaTimeSet () const
 
void SetSolverAsyncDeltaTime (const float NewSolverAsyncDeltaTime)
 
bool ShouldInterpolateWhenSubStepping () const
 
float GetMassOverride () const
 
bool IsUsingMACD () const
 
bool IsPartialIslandSleepAllowed () const
 
ENGINE_API void SetMassOverride (float MassInKG, bool bNewOverrideMass=true)
 
ENGINE_API bool GetRigidBodyState (FRigidBodyState &OutState)
 
ENGINE_API void UseExternalCollisionProfile (UBodySetup *InExternalCollisionProfileBodySetup)
 
ENGINE_API void ClearExternalCollisionProfile ()
 
ENGINE_API void SetDOFLock (EDOFMode::Type NewDOFMode)
 
ENGINE_API FVector GetLockedAxis () const
 
ENGINE_API void CreateDOFLock ()
 
ENGINE_API UBodySetupGetBodySetup () const
 
ENGINE_API FPhysicsActorHandle GetPhysicsActor () const
 
ENGINE_API FPhysicsActorHandle GetPhysicsActorWeldRoot () const
 
ENGINE_API void SetPhysicsActor (FPhysicsActorHandle InHandle)
 
ENGINE_API void ReleasePhysicsActor ()
 
ENGINE_API FPhysicsActorHandleGetPhysicsActorHandle ()
 
ENGINE_API const FPhysicsActorHandleGetPhysicsActorHandle () const
 
ENGINE_API const FPhysicsActorHandleGetActorReferenceWithWelding () const
 
void SetPhysicsActorHandle (FPhysicsActorHandle InHandle)
 
FBodyInstanceAsyncPhysicsTickHandle GetBodyInstanceAsyncPhysicsTickHandle () const
 
ENGINE_API FBodyInstance ()
 
ENGINE_API ~FBodyInstance ()
 
ENGINE_API void LoadProfileData (bool bVerifyProfile)
 
void InitBody (UBodySetup *Setup, const FTransform &Transform, UPrimitiveComponent *PrimComp, FPhysScene *InRBScene)
 
ENGINE_API void InitBody (UBodySetup *Setup, const FTransform &Transform, UPrimitiveComponent *PrimComp, FPhysScene *InRBScene, const FInitBodySpawnParams &SpawnParams, IPhysicsBodyInstanceOwner *BodyInstanceOwner=nullptr)
 
ENGINE_API void InitBody (UBodySetup *Setup, const FTransform &Transform, UPrimitiveComponent *PrimComp, UObject *SourceObject, FPhysScene *InRBScene, const FInitBodySpawnParams &SpawnParams, IPhysicsBodyInstanceOwner *BodyInstanceOwner=nullptr)
 
ENGINE_API FPhysSceneGetPhysicsScene ()
 
ENGINE_API const FPhysSceneGetPhysicsScene () const
 
ENGINE_API void InitDynamicProperties_AssumesLocked ()
 
ENGINE_API void BuildBodyFilterData (FBodyCollisionFilterData &OutFilterData, const int32 ShapeIndex=INDEX_NONE) const
 
ENGINE_API int32 GetAllShapes_AssumesLocked (TArray< FPhysicsShapeHandle > &OutShapes) const
 
ENGINE_API void TermBody (bool bNeverDeferRelease=false)
 
ENGINE_API FAsyncTermBodyPayload StartAsyncTermBody_GameThread ()
 
ENGINE_API bool Weld (FBodyInstance *Body, const FTransform &RelativeTM)
 
ENGINE_API void UnWeld (FBodyInstance *Body)
 
ENGINE_API void ApplyWeldOnChildren ()
 
ENGINE_API void PostShapeChange ()
 
ENGINE_API bool UpdateBodyScale (const FVector &InScale3D, bool bForceUpdate=false)
 
ENGINE_API void UpdateTriMeshVertices (const TArray< FVector > &NewPositions)
 
FVector GetCOMPosition () const
 
ENGINE_API FTransform GetMassSpaceToWorldSpace () const
 
ENGINE_API FTransform GetMassSpaceLocal () const
 
ENGINE_API void SetMassSpaceLocal (const FTransform &NewMassSpaceLocalTM)
 
ENGINE_API void DrawCOMPosition (class FPrimitiveDrawInterface *PDI, float COMRenderSize, const FColor &COMRenderColor)
 
ENGINE_API void CopyBodyInstancePropertiesFrom (const FBodyInstance *FromInst)
 
ENGINE_API void CopyRuntimeBodyInstancePropertiesFrom (const FBodyInstance *FromInst)
 
ENGINE_API UPhysicalMaterialGetSimplePhysicalMaterial () const
 
ENGINE_API TArray< UPhysicalMaterial * > GetComplexPhysicalMaterials () const
 
ENGINE_API TArray< UPhysicalMaterial * > GetComplexPhysicalMaterials (TArray< FPhysicalMaterialMaskParams > &OutPhysMaterialMasks) const
 
ENGINE_API void GetComplexPhysicalMaterials (TArray< UPhysicalMaterial * > &OutPhysMaterials) const
 
ENGINE_API void GetComplexPhysicalMaterials (TArray< UPhysicalMaterial * > &OutPhysMaterials, TArray< FPhysicalMaterialMaskParams > &OutPhysMaterialMasks) const
 
ENGINE_API const struct FWalkableSlopeOverrideGetWalkableSlopeOverride () const
 
ENGINE_API void SetWalkableSlopeOverride (const FWalkableSlopeOverride &NewOverride, bool bNewOverideSetting=true)
 
ENGINE_API bool GetOverrideWalkableSlopeOnInstance () const
 
ENGINE_API bool IsDynamic () const
 
ENGINE_API bool IsNonKinematic () const
 
ENGINE_API float GetBodyMass () const
 
ENGINE_API FBox GetBodyBounds () const
 
ENGINE_API FBox GetBodyBoundsLocal () const
 
ENGINE_API FVector GetBodyInertiaTensor () const
 
bool IsInertiaConditioningEnabled () const
 
ENGINE_API void SetInertiaConditioningEnabled (bool bEnabled)
 
ENGINE_API void ApplyAsyncPhysicsCommand (FAsyncPhysicsTimestamp TimeStamp, const bool bIsInternal, APlayerController *PlayerController, const TFunction< void()> &Command)
 
ENGINE_API void SetInstanceSimulatePhysics (bool bSimulate, bool bMaintainPhysicsBlending=false, bool bPreserveExistingAttachment=false)
 
ENGINE_API void UpdateInstanceSimulatePhysics ()
 
bool IsInstanceSimulatingPhysics () const
 
ENGINE_API bool IsInstanceAwake () const
 
ENGINE_API void WakeInstance ()
 
ENGINE_API void PutInstanceToSleep ()
 
ENGINE_API float GetSleepThresholdMultiplier () const
 
ENGINE_API void AddCustomPhysics (FCalculateCustomPhysics &CalculateCustomPhysics)
 
ENGINE_API void AddForce (const FVector &Force, bool bAllowSubstepping=true, bool bAccelChange=false, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void AddForceAtPosition (const FVector &Force, const FVector &Position, bool bAllowSubstepping=true, bool bIsLocalForce=false, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void ClearForces (bool bAllowSubstepping=true)
 
ENGINE_API void SetOneWayInteraction (bool InOneWayInteraction=true)
 
ENGINE_API void AddTorqueInRadians (const FVector &Torque, bool bAllowSubstepping=true, bool bAccelChange=false, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void ClearTorques (bool bAllowSubstepping=true)
 
ENGINE_API void AddAngularImpulseInRadians (const FVector &Impulse, bool bVelChange, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void AddImpulse (const FVector &Impulse, bool bVelChange, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void AddImpulseAtPosition (const FVector &Impulse, const FVector &Position, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void AddVelocityChangeImpulseAtLocation (const FVector &Impulse, const FVector &Position, const FAsyncPhysicsTimestamp TimeStamp=FAsyncPhysicsTimestamp(), APlayerController *PlayerController=nullptr)
 
ENGINE_API void SetLinearVelocity (const FVector &NewVel, bool bAddToCurrent, bool bAutoWake=true)
 
ENGINE_API void SetAngularVelocityInRadians (const FVector &NewAngVel, bool bAddToCurrent, bool bAutoWake=true)
 
ENGINE_API void SetMaxAngularVelocityInRadians (float NewMaxAngVel, bool bAddToCurrent, bool bUpdateOverrideMaxAngularVelocity=true)
 
ENGINE_API float GetMaxAngularVelocityInRadians () const
 
bool GetOverrideMaxDepenetrationVelocity () const
 
ENGINE_API void SetOverrideMaxDepenetrationVelocity (bool bInEnabled)
 
ENGINE_API void SetMaxDepenetrationVelocity (float MaxVelocity)
 
float GetMaxDepenetrationVelocity () const
 
ENGINE_API void SetInstanceNotifyRBCollision (bool bNewNotifyCollision)
 
ENGINE_API void SetEnableGravity (bool bGravityEnabled)
 
ENGINE_API void SetGravityGroupIndex (int32 NewGravityGroupIndex)
 
ENGINE_API void SetUpdateKinematicFromSimulation (bool bUpdateKinematicFromSimulation)
 
ENGINE_API void SetGyroscopicTorqueEnabled (bool bInGyroscopicTorqueEnabled)
 
ENGINE_API void SetContactModification (bool bNewContactModification)
 
ENGINE_API void SetSmoothEdgeCollisionsEnabled (bool bNewSmoothEdgeCollisions)
 
ENGINE_API void SetUseCCD (bool bInUseCCD)
 
ENGINE_API void SetUseMACD (bool bInUseMACD)
 
ENGINE_API void SetAllowPartialIslandSleep (bool bInAllowPartialIslandSleep)
 
ENGINE_API void SetPositionSolverIterationCount (uint8 PositionSolverIterationCountIn)
 
ENGINE_API void SetVelocitySolverIterationCount (uint8 VelocitySolverIterationCountIn)
 
ENGINE_API void SetProjectionSolverIterationCount (uint8 ProjectionSolverIterationCountIn)
 
ENGINE_API void SetOverrideIterationCounts (bool bOverride)
 
int32 GetPositionSolverIterationCount () const
 
int32 GetVelocitySolverIterationCount () const
 
int32 GetProjectionSolverIterationCount () const
 
bool GetUseMACD () const
 
bool GetAllowPartialIslandSleep () const
 
ENGINE_API void SetPhysicsDisabled (bool bSetDisabled)
 
ENGINE_API bool IsPhysicsDisabled () const
 
ENGINE_API EPhysicsReplicationMode GetPhysicsReplicationMode () const
 
ENGINE_API void ExecuteOnCalculateCustomProjection (FTransform &WorldTM) const
 
ENGINE_API FCalculateCustomProjectionOnCalculateCustomProjection ()
 
ENGINE_API FRecalculatedMassPropertiesOnRecalculatedMassProperties ()
 
ENGINE_API bool IsValidBodyInstance () const
 
ENGINE_API FTransform GetUnrealWorldTransform (bool bWithProjection=true, bool bForceGlobalPose=false) const
 
ENGINE_API FTransform GetUnrealWorldTransform_AssumesLocked (bool bWithProjection=true, bool bForceGlobalPose=false) const
 
ENGINE_API FTransform GetKinematicTarget () const
 
ENGINE_API FTransform GetKinematicTarget_AssumesLocked () const
 
ENGINE_API void SetBodyTransform (const FTransform &NewTransform, ETeleportType Teleport, bool bAutoWake=true)
 
ENGINE_API FVector GetUnrealWorldVelocity () const
 
ENGINE_API FVector GetUnrealWorldVelocity_AssumesLocked () const
 
ENGINE_API FVector GetUnrealWorldAngularVelocityInRadians () const
 
ENGINE_API FVector GetUnrealWorldAngularVelocityInRadians_AssumesLocked () const
 
ENGINE_API FVector GetUnrealWorldVelocityAtPoint (const FVector &Point) const
 
ENGINE_API FVector GetUnrealWorldVelocityAtPoint_AssumesLocked (const FVector &Point) const
 
UPhysicalMaterialGetPhysMaterialOverride () const
 
ENGINE_API void SetPhysMaterialOverride (class UPhysicalMaterial *NewPhysMaterial)
 
ENGINE_API void SetContactReportForceThreshold (float Threshold)
 
ENGINE_API bool SetResponseToChannel (ECollisionChannel Channel, ECollisionResponse NewResponse)
 
ECollisionResponse GetResponseToChannel (ECollisionChannel Channel) const
 
ENGINE_API bool SetResponseToAllChannels (ECollisionResponse NewResponse)
 
ENGINE_API bool ReplaceResponseToChannels (ECollisionResponse OldResponse, ECollisionResponse NewResponse)
 
ENGINE_API bool SetResponseToChannels (const FCollisionResponseContainer &NewResponses)
 
ENGINE_API bool SetShapeResponseToChannels (const int32 ShapeIndex, const FCollisionResponseContainer &NewResponses)
 
const FCollisionResponseContainerGetResponseToChannels () const
 
ENGINE_API const FCollisionResponseContainerGetShapeResponseToChannels (const int32 ShapeIndex) const
 
ENGINE_API const FCollisionResponseContainerGetShapeResponseToChannels (const int32 ShapeIndex, const FCollisionResponseContainer &DefaultResponseContainer) const
 
ENGINE_API void SetObjectType (ECollisionChannel Channel)
 
ECollisionChannel GetObjectType () const
 
ENGINE_API void SetCollisionEnabled (ECollisionEnabled::Type NewType, bool bUpdatePhysicsFilterData=true)
 
ENGINE_API void SetShapeCollisionEnabled (const int32 ShapeIndex, ECollisionEnabled::Type NewType, bool bUpdatePhysicsFilterData=true)
 
ECollisionEnabled::Type GetCollisionEnabled (bool bCheckOwner=true) const
 
ENGINE_API ECollisionEnabled::Type GetShapeCollisionEnabled (const int32 ShapeIndex) const
 
ENGINE_API void SetCollisionProfileNameDeferred (FName InCollisionProfileName)
 
ENGINE_API void SetCollisionProfileName (FName InCollisionProfileName)
 
ENGINE_API void SetMaskFilter (FMaskFilter InMaskFilter)
 
FMaskFilter GetMaskFilter () const
 
ENGINE_API FName GetCollisionProfileName () const
 
ENGINE_API bool DoesUseCollisionProfile () const
 
ENGINE_API void SetMassScale (float InMassScale=1.f)
 
ENGINE_API void UpdateMassProperties ()
 
ENGINE_API void UpdateDampingProperties ()
 
ENGINE_API void UpdatePhysicalMaterials ()
 
ENGINE_API void ApplyMaterialToInstanceShapes_AssumesLocked (UPhysicalMaterial *SimplePhysMat, TArray< UPhysicalMaterial * > &ComplexPhysMats, const TArrayView< FPhysicalMaterialMaskParams > &ComplexPhysMatMasks)
 
ENGINE_API void UpdatePhysicsFilterData ()
 
ENGINE_API FString GetBodyDebugName () const
 
ENGINE_API bool LineTrace (struct FHitResult &OutHit, const FVector &Start, const FVector &End, bool bTraceComplex, bool bReturnPhysicalMaterial=false) const
 
ENGINE_API bool Sweep (struct FHitResult &OutHit, const FVector &Start, const FVector &End, const FQuat &ShapeWorldRotation, const FCollisionShape &Shape, bool bTraceComplex) const
 
ENGINE_API bool OverlapTest (const FVector &Position, const FQuat &Rotation, const struct FCollisionShape &CollisionShape, FMTDResult *OutMTD=nullptr, bool bTraceComplex=false) const
 
ENGINE_API bool OverlapTest_AssumesLocked (const FVector &Position, const FQuat &Rotation, const struct FCollisionShape &CollisionShape, FMTDResult *OutMTD=nullptr, bool bTraceComplex=false) const
 
bool OverlapTestForBodies (const FVector &Position, const FQuat &Rotation, const TArray< FBodyInstance * > &Bodies, bool bTraceComplex=false) const
 
bool OverlapTestForBody (const FVector &Position, const FQuat &Rotation, FBodyInstance *Body, bool bTraceComplex=false) const
 
ENGINE_API bool OverlapMulti (TArray< struct FOverlapResult > &InOutOverlaps, const class UWorld *World, const FTransform *pWorldToComponent, const FVector &Pos, const FQuat &Rot, ECollisionChannel TestChannel, const struct FComponentQueryParams &Params, const struct FCollisionResponseParams &ResponseParams, const FCollisionObjectQueryParams &ObjectQueryParams=FCollisionObjectQueryParams::DefaultObjectQueryParam) const
 
bool OverlapMulti (TArray< struct FOverlapResult > &InOutOverlaps, const class UWorld *World, const FTransform *pWorldToComponent, const FVector &Pos, const FRotator &Rot, ECollisionChannel TestChannel, const struct FComponentQueryParams &Params, const struct FCollisionResponseParams &ResponseParams, const FCollisionObjectQueryParams &ObjectQueryParams=FCollisionObjectQueryParams::DefaultObjectQueryParam) const
 
ENGINE_API void AddRadialImpulseToBody (const FVector &Origin, float Radius, float Strength, uint8 Falloff, bool bVelChange=false)
 
ENGINE_API void AddRadialForceToBody (const FVector &Origin, float Radius, float Strength, uint8 Falloff, bool bAccelChange=false, bool bAllowSubstepping=true)
 
ENGINE_API bool GetSquaredDistanceToBody (const FVector &Point, float &OutDistanceSquared, FVector &OutPointOnBody) const
 
ENGINE_API float GetDistanceToBody (const FVector &Point, FVector &OutPointOnBody) const
 
ENGINE_API void GetBodyInstanceResourceSizeEx (FResourceSizeEx &CumulativeResourceSize) const
 
ENGINE_API void FixupData (class UObject *Loader)
 
const FCollisionResponseGetCollisionResponse () const
 
ENGINE_API void ApplyDeferredCollisionProfileName ()
 
ENGINE_API const FBodyInstanceGetOriginalBodyInstance (const FPhysicsShapeHandle &InShape) const
 
ENGINE_API const FTransformGetRelativeBodyTransform (const FPhysicsShapeHandle &InShape) const
 
ENGINE_API bool IsShapeBoundToBody (const FPhysicsShapeHandle &Shape) const
 
ENGINE_API const TMap< FPhysicsShapeHandle, FWeldInfo > * GetCurrentWeldInfo () const
 
UE_INTERNAL ENGINE_API void SerializeState (Chaos::FSerializedDataBuffer &OutSerializedState, Chaos::ESerializedDataContext DataContext)
 
UE_INTERNAL ENGINE_API void ApplySerializedState (Chaos::FSerializedDataBufferPtr &&InSerializedState, Chaos::ESerializedDataContext DataContext)
 
template<typename AllocatorType >
bool OverlapTestForBodiesImpl (const FVector &Pos, const FQuat &Rot, const TArray< FBodyInstance *, AllocatorType > &Bodies, bool bTraceComplex) const
 
- Public Member Functions inherited from FBodyInstanceCore
PHYSICSCORE_API FBodyInstanceCore ()
 
PHYSICSCORE_API bool ShouldInstanceSimulatingPhysics () const
 

Static Public Member Functions

static ENGINE_API EDOFMode::Type ResolveDOFMode (EDOFMode::Type DOFMode)
 
static ENGINE_API bool ValidateTransform (const FTransform &Transform, const FString &DebugName, const UBodySetup *Setup)
 
static ENGINE_API void InitStaticBodies (const TArray< FBodyInstance * > &Bodies, const TArray< FTransform > &Transforms, UBodySetup *BodySetup, class UPrimitiveComponent *PrimitiveComp, FPhysScene *InRBScene)
 
static ENGINE_API void InitStaticBodies (TArray< FBodyInstance * > &&Bodies, TArray< FTransform > &&Transforms, UBodySetup *BodySetup, class UPrimitiveComponent *PrimitiveComp, FPhysScene *InRBScene, IPhysicsBodyInstanceOwner *BodyInstanceOwner=nullptr)
 
static ENGINE_API void BuildBodyCollisionFlags (FBodyCollisionFlags &OutFlags, ECollisionEnabled::Type UseCollisionEnabled, bool bUseComplexAsSimple)
 
static ENGINE_API void AsyncTermBody (FAsyncTermBodyPayload &Payload)
 
static ENGINE_API UPhysicalMaterialGetSimplePhysicalMaterial (const FBodyInstance *BodyInstance, TWeakObjectPtr< UPrimitiveComponent > Owner, TWeakObjectPtr< UBodySetup > BodySetupPtr, IPhysicsBodyInstanceOwner *BodyInstanceOwner=nullptr)
 
static ENGINE_API void GetComplexPhysicalMaterials (const FBodyInstance *BodyInstance, TWeakObjectPtr< UPrimitiveComponent > Owner, TArray< UPhysicalMaterial * > &OutPhysMaterials, TArray< FPhysicalMaterialMaskParams > *OutPhysMaterialMasks=nullptr, IPhysicsBodyInstanceOwner *InBodyInstanceOwner=nullptr)
 
static ENGINE_API void ApplyMaterialToShape_AssumesLocked (const FPhysicsShapeHandle &InShape, UPhysicalMaterial *SimplePhysMat, const TArrayView< UPhysicalMaterial * > &ComplexPhysMats, const TArrayView< FPhysicalMaterialMaskParams > *ComplexPhysMatMasks=nullptr)
 

Public Attributes

int32 InstanceBodyIndex
 
int16 InstanceBoneIndex
 
uint8 PositionSolverIterationCount
 
uint8 VelocitySolverIterationCount
 
uint8 ProjectionSolverIterationCount
 
BodyInstanceSceneState CurrentSceneState
 
ESleepFamily SleepFamily
 
TEnumAsByte< EDOFMode::TypeDOFMode
 
uint8 bUseCCD: 1
 
uint8 bIgnoreAnalyticCollisions: 1
 
uint8 bNotifyRigidBodyCollision: 1
 
uint8 bContactModification: 1
 
uint8 bSmoothEdgeCollisions: 1
 
uint8 bLockTranslation: 1
 
uint8 bLockRotation: 1
 
uint8 bLockXTranslation: 1
 
uint8 bLockYTranslation: 1
 
uint8 bLockZTranslation: 1
 
uint8 bLockXRotation: 1
 
uint8 bLockYRotation: 1
 
uint8 bLockZRotation: 1
 
uint8 bOverrideMaxAngularVelocity: 1
 
uint8 bHACK_DisableCollisionResponse: 1
 
uint8 bHACK_DisableSkelComponentFilterOverriding: 1
 
uint8 bOverrideSolverAsyncDeltaTime: 1
 
float SolverAsyncDeltaTime
 
FVector Scale3D
 
float LinearDamping
 
float AngularDamping
 
FVector CustomDOFPlaneNormal
 
FVector COMNudge
 
float MassScale
 
uint8 GravityGroupIndex
 
FVector InertiaTensorScale
 
FConstraintInstanceDOFConstraint
 
FBodyInstanceWeldParent
 
float MaxAngularVelocity
 
float CustomSleepThresholdMultiplier
 
float StabilizationThresholdMultiplier
 
float PhysicsBlendWeight
 
FPhysicsActorHandle ActorHandle
 
TWeakObjectPtr< class UPrimitiveComponent > OwnerComponent
 
IPhysicsBodyInstanceOwnerBodyInstanceOwner
 
TWeakObjectPtr< UObjectSourceObject
 
FPhysicsUserData PhysicsUserData
 
- Public Attributes inherited from FBodyInstanceCore
TWeakObjectPtr< UBodySetupCoreBodySetup
 
uint8 bSimulatePhysics: 1
 
uint8 bOverrideMass: 1
 
uint8 bEnableGravity: 1
 
uint8 bUpdateKinematicFromSimulation: 1
 
uint8 bGyroscopicTorqueEnabled: 1
 
uint8 bAutoWeld: 1
 
uint8 bStartAwake:1
 
uint8 bGenerateWakeEvents: 1
 
uint8 bUpdateMassWhenScaleChanges:1
 
uint8 bDirtyMassProps: 1
 

Protected Member Functions

 UPROPERTY (EditAnywhere, BlueprintReadOnly, Category=Physics, meta=(editcondition="bOverrideMass", ClampMin="0.001", UIMin="0.001", DisplayName="Mass (kg)")) float MassInKgOverride
 
ENGINE_API void UpdateInterpolateWhenSubStepping ()
 

Protected Attributes

uint8 bOverrideMaxDepenetrationVelocity: 1
 
uint8 bOverrideWalkableSlopeOnInstance: 1
 
uint8 bOverrideIterationCounts: 1
 
uint8 bInterpolateWhenSubStepping: 1
 
uint8 bPendingCollisionProfileSetup: 1
 
uint8 bInertiaConditioning: 1
 Enable automatic inertia conditioning to stabilize constraints.
 
uint8 bOneWayInteraction: 1
 
float MaxDepenetrationVelocity
 
TWeakObjectPtr< UBodySetupExternalCollisionProfileBodySetup
 
struct FWalkableSlopeOverride WalkableSlopeOverride
 
TObjectPtr< class UPhysicalMaterialPhysMaterialOverride
 

Friends

class UPhysicsAsset
 
class UCollisionProfile
 
class FBodyInstanceCustomization
 
struct FUpdateCollisionResponseHelper
 
class FBodySetupDetails
 
struct Chaos::Private::FInitBodiesHelperBaseInternal
 
class FBodyInstanceCustomizationHelper
 
class FFoliageTypeCustomizationHelpers
 
ENGINE_API FArchiveoperator<< (FArchive &Ar, FBodyInstance &BodyInst)
 

Detailed Description

Container for a physics representation of an object

Constructor & Destructor Documentation

◆ FBodyInstance()

FBodyInstance::FBodyInstance ( )

Constructor

◆ ~FBodyInstance()

FBodyInstance::~FBodyInstance ( )
default

Member Function Documentation

◆ AddAngularImpulseInRadians()

void FBodyInstance::AddAngularImpulseInRadians ( const FVector Impulse,
bool  bVelChange,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add a rotational impulse to this body

◆ AddCustomPhysics()

void FBodyInstance::AddCustomPhysics ( FCalculateCustomPhysics CalculateCustomPhysics)

Add custom forces and torques on the body. The callback will be called more than once, if substepping enabled, for every substep.

◆ AddForce()

void FBodyInstance::AddForce ( const FVector Force,
bool  bAllowSubstepping = true,
bool  bAccelChange = false,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add a force to this body

◆ AddForceAtPosition()

void FBodyInstance::AddForceAtPosition ( const FVector Force,
const FVector Position,
bool  bAllowSubstepping = true,
bool  bIsLocalForce = false,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add a force at a particular position (world space when bIsLocalForce = false, body space otherwise)

◆ AddImpulse()

void FBodyInstance::AddImpulse ( const FVector Impulse,
bool  bVelChange,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add an impulse to this body

◆ AddImpulseAtPosition()

void FBodyInstance::AddImpulseAtPosition ( const FVector Impulse,
const FVector Position,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add an impulse to this body and a particular world position

◆ AddRadialForceToBody()

void FBodyInstance::AddRadialForceToBody ( const FVector Origin,
float  Radius,
float  Strength,
uint8  Falloff,
bool  bAccelChange = false,
bool  bAllowSubstepping = true 
)

Add a force to this bodyinstance, originating from the supplied world-space location.

Parameters
OriginOrigin of force in world space.
RadiusRadius within which to apply the force.
StrengthStrength of force to apply.
FalloffAllows you to control the strength of the force as a function of distance from Origin.
bAccelChangeIf true, Strength is taken as a change in acceleration instead of a physical force (i.e. mass will have no effect).
bAllowSubsteppingWhether we should sub-step this radial force. You should only turn this off if you're calling it from a sub-step callback, otherwise there will be energy loss

◆ AddRadialImpulseToBody()

void FBodyInstance::AddRadialImpulseToBody ( const FVector Origin,
float  Radius,
float  Strength,
uint8  Falloff,
bool  bVelChange = false 
)

Add an impulse to this bodyinstance, radiating out from the specified position.

Parameters
OriginPoint of origin for the radial impulse blast, in world space
RadiusSize of radial impulse. Beyond this distance from Origin, there will be no affect.
StrengthMaximum strength of impulse applied to body.
FalloffAllows you to control the strength of the impulse as a function of distance from Origin.
bVelChangeIf true, the Strength is taken as a change in velocity instead of an impulse (ie. mass will have no effect).

◆ AddTorqueInRadians()

void FBodyInstance::AddTorqueInRadians ( const FVector Torque,
bool  bAllowSubstepping = true,
bool  bAccelChange = false,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add a torque to this body

◆ AddVelocityChangeImpulseAtLocation()

void FBodyInstance::AddVelocityChangeImpulseAtLocation ( const FVector Impulse,
const FVector Position,
const FAsyncPhysicsTimestamp  TimeStamp = FAsyncPhysicsTimestamp(),
APlayerController PlayerController = nullptr 
)

Add a velocity change impulse to this body and a particular world position

◆ ApplyAsyncPhysicsCommand()

void FBodyInstance::ApplyAsyncPhysicsCommand ( FAsyncPhysicsTimestamp  TimeStamp,
const bool  bIsInternal,
APlayerController PlayerController,
const TFunction< void()> &  Command 
)

Apply async physics command onto the body instance

◆ ApplyDeferredCollisionProfileName()

void FBodyInstance::ApplyDeferredCollisionProfileName ( )

Applies a deferred collision profile

◆ ApplyMaterialToInstanceShapes_AssumesLocked()

void FBodyInstance::ApplyMaterialToInstanceShapes_AssumesLocked ( UPhysicalMaterial SimplePhysMat,
TArray< UPhysicalMaterial * > &  ComplexPhysMats,
const TArrayView< FPhysicalMaterialMaskParams > &  ComplexPhysMatMasks 
)

Note: This function is not thread safe. Make sure you obtain the appropriate physics scene lock before calling it

◆ ApplyMaterialToShape_AssumesLocked()

void FBodyInstance::ApplyMaterialToShape_AssumesLocked ( const FPhysicsShapeHandle InShape,
UPhysicalMaterial SimplePhysMat,
const TArrayView< UPhysicalMaterial * > &  ComplexPhysMats,
const TArrayView< FPhysicalMaterialMaskParams > *  ComplexPhysMatMasks = nullptr 
)
static

Apply a material directly to the passed in shape. Note this function is very advanced and requires knowledge of shape sharing as well as threading. Note: assumes the appropriate locks have been obtained

Parameters
PShapeThe shape we are applying the material to
SimplePhysMatThe material to use if a simple shape is provided (or complex materials are empty)
ComplexPhysMatsThe array of materials to apply if a complex shape is provided

◆ ApplySerializedState()

void FBodyInstance::ApplySerializedState ( Chaos::FSerializedDataBufferPtr &&  InSerializedState,
Chaos::ESerializedDataContext  DataContext 
)

Deserializes the provided array of bytes representing a saved physics thread state and applies it to this body

◆ ApplyWeldOnChildren()

void FBodyInstance::ApplyWeldOnChildren ( )

Finds all children that are technically welded to us (for example kinematics are welded but not as far as physx is concerned) and apply the actual physics engine weld on them

◆ AsyncTermBody()

void FBodyInstance::AsyncTermBody ( FAsyncTermBodyPayload Payload)
static

Releases body resources provided by Payload which was returned by StartAsyncTermBody_GameThread (can be called outside of game thread).

Parameters
Payloadbody resources to release.

◆ BuildBodyCollisionFlags()

void FBodyInstance::BuildBodyCollisionFlags ( FBodyCollisionFlags OutFlags,
ECollisionEnabled::Type  UseCollisionEnabled,
bool  bUseComplexAsSimple 
)
static

Build the flags to control which types of collision (sim and query) shapes owned by this BodyInstance should have.

◆ BuildBodyFilterData()

void FBodyInstance::BuildBodyFilterData ( FBodyCollisionFilterData OutFilterData,
const int32  ShapeIndex = INDEX_NONE 
) const

Build the sim and query filter data (for simple and complex shapes) based on the settings of this BodyInstance (and its associated BodySetup)

◆ ClearExternalCollisionProfile()

void FBodyInstance::ClearExternalCollisionProfile ( )

◆ ClearForces()

void FBodyInstance::ClearForces ( bool  bAllowSubstepping = true)

Clear accumulated forces on this body

◆ ClearTorques()

void FBodyInstance::ClearTorques ( bool  bAllowSubstepping = true)

Clear accumulated torques on this body

◆ CopyBodyInstancePropertiesFrom()

void FBodyInstance::CopyBodyInstancePropertiesFrom ( const FBodyInstance FromInst)

Utility for copying properties from one BodyInstance to another.

◆ CopyRuntimeBodyInstancePropertiesFrom()

void FBodyInstance::CopyRuntimeBodyInstancePropertiesFrom ( const FBodyInstance FromInst)

Utility for copying only the runtime instanced properties from one BodyInstance to another.

◆ CreateDOFLock()

void FBodyInstance::CreateDOFLock ( )

◆ DoesUseCollisionProfile()

bool FBodyInstance::DoesUseCollisionProfile ( ) const

return true if it uses Collision Profile System. False otherwise

◆ DrawCOMPosition()

void FBodyInstance::DrawCOMPosition ( class FPrimitiveDrawInterface PDI,
float  COMRenderSize,
const FColor COMRenderColor 
)

Draws the center of mass as a wire star

◆ ExecuteOnCalculateCustomProjection()

void FBodyInstance::ExecuteOnCalculateCustomProjection ( FTransform WorldTM) const

Executes the OnCalculateCustomProjection delegate if bound.

◆ FixupData()

void FBodyInstance::FixupData ( class UObject Loader)

UObject notification by OwningComponent

◆ GetActorReferenceWithWelding()

const FPhysicsActorHandle & FBodyInstance::GetActorReferenceWithWelding ( ) const

◆ GetAllowPartialIslandSleep()

bool FBodyInstance::GetAllowPartialIslandSleep ( ) const
inline

[EXPERIMENTAL] Whether Partial Island Sleep is permitted for the island this body is in

◆ GetAllShapes_AssumesLocked()

int32 FBodyInstance::GetAllShapes_AssumesLocked ( TArray< FPhysicsShapeHandle > &  OutShapes) const

Utility to get all the shapes from a FBodyInstance NOTE: This function is not thread safe. You must hold the physics scene lock while calling it and reading/writing from the shapes

◆ GetBodyBounds()

FBox FBodyInstance::GetBodyBounds ( ) const

Return bounds of physics representation in world space

◆ GetBodyBoundsLocal()

FBox FBodyInstance::GetBodyBoundsLocal ( ) const

Return bounds of physics representation in world space

◆ GetBodyDebugName()

FString FBodyInstance::GetBodyDebugName ( ) const

Get the name for this body, for use in debugging

◆ GetBodyInertiaTensor()

FVector FBodyInstance::GetBodyInertiaTensor ( ) const

Return the body's inertia tensor. This is returned in local mass space

◆ GetBodyInstanceAsyncPhysicsTickHandle()

FBodyInstanceAsyncPhysicsTickHandle FBodyInstance::GetBodyInstanceAsyncPhysicsTickHandle ( ) const
inline

◆ GetBodyInstanceResourceSizeEx()

void FBodyInstance::GetBodyInstanceResourceSizeEx ( FResourceSizeEx CumulativeResourceSize) const

Returns memory used by resources allocated for this body instance ( ex. physics resources )

◆ GetBodyMass()

float FBodyInstance::GetBodyMass ( ) const

Returns the body's mass

◆ GetBodySetup()

UBodySetup * FBodyInstance::GetBodySetup ( ) const

◆ GetCollisionEnabled()

ECollisionEnabled::Type FBodyInstance::GetCollisionEnabled ( bool  bCheckOwner = true) const
inline

Get the current type of collision enabled

◆ GetCollisionProfileName()

FName FBodyInstance::GetCollisionProfileName ( ) const

Returns the collision profile name that will be used.

◆ GetCollisionResponse()

const FCollisionResponse & FBodyInstance::GetCollisionResponse ( ) const
inline

◆ GetComplexPhysicalMaterials() [1/5]

TArray< UPhysicalMaterial * > FBodyInstance::GetComplexPhysicalMaterials ( ) const

Get the complex PhysicalMaterials array for this body

◆ GetComplexPhysicalMaterials() [2/5]

void FBodyInstance::GetComplexPhysicalMaterials ( const FBodyInstance BodyInstance,
TWeakObjectPtr< UPrimitiveComponent >  Owner,
TArray< UPhysicalMaterial * > &  OutPhysMaterials,
TArray< FPhysicalMaterialMaskParams > *  OutPhysMaterialMasks = nullptr,
IPhysicsBodyInstanceOwner InBodyInstanceOwner = nullptr 
)
static

Find the correct PhysicalMaterial and PhysicalMaterialMasks for complex geometry on a given body and owner. This is really for internal use during serialization

◆ GetComplexPhysicalMaterials() [3/5]

TArray< UPhysicalMaterial * > FBodyInstance::GetComplexPhysicalMaterials ( TArray< FPhysicalMaterialMaskParams > &  OutPhysMaterialMasks) const

Get the complex PhysicalMaterials and PhysicalMaterialMasks array for this body

◆ GetComplexPhysicalMaterials() [4/5]

void FBodyInstance::GetComplexPhysicalMaterials ( TArray< UPhysicalMaterial * > &  OutPhysMaterials) const

Get the complex PhysicalMaterials for this body

◆ GetComplexPhysicalMaterials() [5/5]

void FBodyInstance::GetComplexPhysicalMaterials ( TArray< UPhysicalMaterial * > &  OutPhysMaterials,
TArray< FPhysicalMaterialMaskParams > &  OutPhysMaterialMasks 
) const

Get the complex PhysicalMaterials and PhysicalMaterialMasks for this body

◆ GetCOMPosition()

FVector FBodyInstance::GetCOMPosition ( ) const
inline

Returns the center of mass of this body (in world space)

◆ GetCurrentWeldInfo()

const TMap< FPhysicsShapeHandle, FBodyInstance::FWeldInfo > * FBodyInstance::GetCurrentWeldInfo ( ) const

◆ GetDistanceToBody()

float FBodyInstance::GetDistanceToBody ( const FVector Point,
FVector OutPointOnBody 
) const

Get the square of the distance to the body surface if available It is only valid if BodyShape is convex If point is inside or shape is not convex, it will return 0.f

Parameters
PointPoint in world space
OutPointOnBodyPoint on the surface of body closest to Point

◆ GetKinematicTarget()

FTransform FBodyInstance::GetKinematicTarget ( ) const

Get the kinematic target transform in world space from physics body. Will only be relevant/useful if the body is kinematic

◆ GetKinematicTarget_AssumesLocked()

FTransform FBodyInstance::GetKinematicTarget_AssumesLocked ( ) const

Get the kinematic target transform in world space from physics body. Will only be relevant/useful if the body is kinematic

◆ GetLockedAxis()

FVector FBodyInstance::GetLockedAxis ( ) const

◆ GetMaskFilter()

FMaskFilter FBodyInstance::GetMaskFilter ( ) const
inline

Return the ignore mask filter.

◆ GetMassOverride()

float FBodyInstance::GetMassOverride ( ) const
inline

Returns the mass override. See MassInKgOverride for documentation

◆ GetMassSpaceLocal()

FTransform FBodyInstance::GetMassSpaceLocal ( ) const

Returns the mass coordinate system to local space transform (position is local center of mass, rotation should be identity)

◆ GetMassSpaceToWorldSpace()

FTransform FBodyInstance::GetMassSpaceToWorldSpace ( ) const

Returns the mass coordinate system to world space transform (position is world center of mass, rotation is world inertia orientation)

◆ GetMaxAngularVelocityInRadians()

float FBodyInstance::GetMaxAngularVelocityInRadians ( ) const

Get the maximum angular velocity of this body

◆ GetMaxDepenetrationVelocity()

float FBodyInstance::GetMaxDepenetrationVelocity ( ) const
inline

The maximum velocity at which initally-overlapping bodies will separate. Does not affect normal contact resolution.

◆ GetObjectType()

ECollisionChannel FBodyInstance::GetObjectType ( ) const
inline

Get the movement channel of this body

◆ GetOriginalBodyInstance()

const FBodyInstance * FBodyInstance::GetOriginalBodyInstance ( const FPhysicsShapeHandle InShape) const

Returns the original owning body instance. This is needed for welding

◆ GetOverrideMaxDepenetrationVelocity()

bool FBodyInstance::GetOverrideMaxDepenetrationVelocity ( ) const
inline

Are we overriding the MaxDepenetrationVelocity. See SetMaxDepenetrationVelocity

◆ GetOverrideWalkableSlopeOnInstance()

bool FBodyInstance::GetOverrideWalkableSlopeOnInstance ( ) const

Gets bOverrideWalkableSlopeOnInstance

◆ GetPhysicsActor()

FPhysicsActorHandle FBodyInstance::GetPhysicsActor ( ) const

◆ GetPhysicsActorHandle() [1/2]

FPhysicsActorHandle & FBodyInstance::GetPhysicsActorHandle ( )

◆ GetPhysicsActorHandle() [2/2]

const FPhysicsActorHandle & FBodyInstance::GetPhysicsActorHandle ( ) const

◆ GetPhysicsActorWeldRoot()

FPhysicsActorHandle FBodyInstance::GetPhysicsActorWeldRoot ( ) const

◆ GetPhysicsReplicationMode()

EPhysicsReplicationMode FBodyInstance::GetPhysicsReplicationMode ( ) const

Get the EPhysicsReplicationMode from the owning actor. It's recommended to get the parameter directly from the Actor if possible.

◆ GetPhysicsScene() [1/2]

FPhysScene * FBodyInstance::GetPhysicsScene ( )

Get the scene that owns this body.

◆ GetPhysicsScene() [2/2]

const FPhysScene * FBodyInstance::GetPhysicsScene ( ) const

◆ GetPhysMaterialOverride()

UPhysicalMaterial * FBodyInstance::GetPhysMaterialOverride ( ) const
inline

Get physical material override for this body

◆ GetPositionSolverIterationCount()

int32 FBodyInstance::GetPositionSolverIterationCount ( ) const
inline

◆ GetProjectionSolverIterationCount()

int32 FBodyInstance::GetProjectionSolverIterationCount ( ) const
inline

◆ GetRelativeBodyTransform()

const FTransform & FBodyInstance::GetRelativeBodyTransform ( const FPhysicsShapeHandle InShape) const

Returns the relative transform between root body and welded instance owned by the shape.

◆ GetResponseToChannel()

ECollisionResponse FBodyInstance::GetResponseToChannel ( ECollisionChannel  Channel) const
inline

Get the collision response of this body to a particular channel

◆ GetResponseToChannels()

const FCollisionResponseContainer & FBodyInstance::GetResponseToChannels ( ) const
inline

Get Collision ResponseToChannels container for this component

◆ GetRigidBodyState()

bool FBodyInstance::GetRigidBodyState ( FRigidBodyState OutState)

◆ GetShapeCollisionEnabled()

ECollisionEnabled::Type FBodyInstance::GetShapeCollisionEnabled ( const int32  ShapeIndex) const

Get the current type of collision enabled for a particular shape

◆ GetShapeResponseToChannels() [1/2]

const FCollisionResponseContainer & FBodyInstance::GetShapeResponseToChannels ( const int32  ShapeIndex) const

Get Collision ResponseToChannels container for a specific shape in this component

◆ GetShapeResponseToChannels() [2/2]

const FCollisionResponseContainer & FBodyInstance::GetShapeResponseToChannels ( const int32  ShapeIndex,
const FCollisionResponseContainer DefaultResponseContainer 
) const

◆ GetSimplePhysicalMaterial() [1/2]

UPhysicalMaterial * FBodyInstance::GetSimplePhysicalMaterial ( ) const

Find the correct PhysicalMaterial for simple geometry on this body

◆ GetSimplePhysicalMaterial() [2/2]

UPhysicalMaterial * FBodyInstance::GetSimplePhysicalMaterial ( const FBodyInstance BodyInstance,
TWeakObjectPtr< UPrimitiveComponent >  Owner,
TWeakObjectPtr< UBodySetup BodySetupPtr,
IPhysicsBodyInstanceOwner BodyInstanceOwner = nullptr 
)
static

Find the correct PhysicalMaterial for simple geometry on a given body and owner. This is really for internal use during serialization

◆ GetSleepThresholdMultiplier()

float FBodyInstance::GetSleepThresholdMultiplier ( ) const

Gets the multiplier to the threshold where the body will go to sleep automatically.

◆ GetSolverAsyncDeltaTime()

float FBodyInstance::GetSolverAsyncDeltaTime ( ) const
inline

◆ GetSquaredDistanceToBody()

bool FBodyInstance::GetSquaredDistanceToBody ( const FVector Point,
float OutDistanceSquared,
FVector OutPointOnBody 
) const

Get distance to the body surface if available It is only valid if BodyShape is convex If point is inside distance it will be 0 Returns false if geometry is not supported

Parameters
PointPoint in world space
OutDistanceSquaredHow far from the instance the point is. 0 if inside the shape
OutPointOnBodyPoint on the surface of body closest to Point
Returns
true if a distance to the body was found and OutDistanceSquared has been populated

◆ GetUnrealWorldAngularVelocityInRadians()

FVector FBodyInstance::GetUnrealWorldAngularVelocityInRadians ( ) const

Get current angular velocity in world space from physics body.

Note: returns angular velocity in radians per second.

◆ GetUnrealWorldAngularVelocityInRadians_AssumesLocked()

FVector FBodyInstance::GetUnrealWorldAngularVelocityInRadians_AssumesLocked ( ) const

Get current angular velocity in world space from physics body.

Note: returns angular velocity in radians per second.

◆ GetUnrealWorldTransform()

FTransform FBodyInstance::GetUnrealWorldTransform ( bool  bWithProjection = true,
bool  bForceGlobalPose = false 
) const

Get current transform in world space from physics body.

◆ GetUnrealWorldTransform_AssumesLocked()

FTransform FBodyInstance::GetUnrealWorldTransform_AssumesLocked ( bool  bWithProjection = true,
bool  bForceGlobalPose = false 
) const

Get current transform in world space from physics body.

◆ GetUnrealWorldVelocity()

FVector FBodyInstance::GetUnrealWorldVelocity ( ) const

Get current velocity in world space from physics body.

◆ GetUnrealWorldVelocity_AssumesLocked()

FVector FBodyInstance::GetUnrealWorldVelocity_AssumesLocked ( ) const

Get current velocity in world space from physics body.

◆ GetUnrealWorldVelocityAtPoint()

FVector FBodyInstance::GetUnrealWorldVelocityAtPoint ( const FVector Point) const

Get current velocity of a point on this physics body, in world space. Point is specified in world space.

◆ GetUnrealWorldVelocityAtPoint_AssumesLocked()

FVector FBodyInstance::GetUnrealWorldVelocityAtPoint_AssumesLocked ( const FVector Point) const

Get current velocity of a point on this physics body, in world space. Point is specified in world space.

◆ GetUseMACD()

bool FBodyInstance::GetUseMACD ( ) const
inline

[EXPERIMENTAL] Whether Motion-Aware Collision Detection is enabled

◆ GetVelocitySolverIterationCount()

int32 FBodyInstance::GetVelocitySolverIterationCount ( ) const
inline

◆ GetWalkableSlopeOverride()

const FWalkableSlopeOverride & FBodyInstance::GetWalkableSlopeOverride ( ) const

Returns the slope override struct for this instance. If we don't have our own custom setting, it will return the setting from the body setup.

◆ InitBody() [1/3]

void FBodyInstance::InitBody ( UBodySetup Setup,
const FTransform Transform,
UPrimitiveComponent *  PrimComp,
FPhysScene InRBScene 
)
inline

◆ InitBody() [2/3]

void FBodyInstance::InitBody ( UBodySetup Setup,
const FTransform Transform,
UPrimitiveComponent *  PrimComp,
FPhysScene InRBScene,
const FInitBodySpawnParams SpawnParams,
IPhysicsBodyInstanceOwner BodyInstanceOwner = nullptr 
)

Initialise a single rigid body (this FBodyInstance) for the given body setup

Parameters
SetupThe setup to use to create the body
TransformTransform of the body
PrimCompThe owning component
InRBSceneThe physics scene to place the body into
SpawnParamsThe parameters for determining certain spawn behavior
BodyInstanceOwnerThe owning object of the body instance (optional and only used if PrimComp is not set)

◆ InitBody() [3/3]

void FBodyInstance::InitBody ( UBodySetup Setup,
const FTransform Transform,
UPrimitiveComponent *  PrimComp,
UObject SourceObject,
FPhysScene InRBScene,
const FInitBodySpawnParams SpawnParams,
IPhysicsBodyInstanceOwner BodyInstanceOwner = nullptr 
)

Initialise a single rigid body (this FBodyInstance) for the given body setup

Parameters
SetupThe setup to use to create the body
TransformTransform of the body
PrimCompThe owning component
SourceObjectThe source object. If null and PrimComp is not null, it will be set to the owning actor.
InRBSceneThe physics scene to place the body into
SpawnParamsThe parameters for determining certain spawn behavior
BodyInstanceOwnerThe owning object of the body instance (optional and only used if PrimComp is not set)

◆ InitDynamicProperties_AssumesLocked()

void FBodyInstance::InitDynamicProperties_AssumesLocked ( )

Initialise dynamic properties for this instance when using physics - this must be done after scene addition. Note: This function is not thread safe. Make sure to obtain the appropriate physics scene locks before calling this function

◆ InitStaticBodies() [1/2]

void FBodyInstance::InitStaticBodies ( const TArray< FBodyInstance * > &  Bodies,
const TArray< FTransform > &  Transforms,
UBodySetup BodySetup,
class UPrimitiveComponent *  PrimitiveComp,
FPhysScene InRBScene 
)
static

Standalone path to batch initialize large amounts of static bodies, which will be deferred till the next scene update for fast scene addition.

Parameters
Bodies
Transforms
BodySetup
PrimitiveComp
InRBScene

◆ InitStaticBodies() [2/2]

void FBodyInstance::InitStaticBodies ( TArray< FBodyInstance * > &&  Bodies,
TArray< FTransform > &&  Transforms,
UBodySetup BodySetup,
class UPrimitiveComponent *  PrimitiveComp,
FPhysScene InRBScene,
IPhysicsBodyInstanceOwner BodyInstanceOwner = nullptr 
)
static

Standalone path to batch initialize large amounts of static bodies. Note that this function will steal Bodies and Transforms arrays.

Parameters
BodiesThe list of BodyInstances to initialize.
TransformsThe list of BodyInstance transform
BodySetupThe BodySetup to use
PrimitiveCompThe associated primitive component
InRBSceneThe associated physics scene
BodyInstanceOwnerThe associated owning object of the body instance (optional and only used if PrimitiveComp is not set)

◆ IsDynamic()

bool FBodyInstance::IsDynamic ( ) const

Returns true if the body is not static

◆ IsInertiaConditioningEnabled()

bool FBodyInstance::IsInertiaConditioningEnabled ( ) const
inline

Whether inertia conditioning is enabled.

See also
bInertiaConditioning

◆ IsInstanceAwake()

bool FBodyInstance::IsInstanceAwake ( ) const

Returns whether this body is awake

◆ IsInstanceSimulatingPhysics()

bool FBodyInstance::IsInstanceSimulatingPhysics ( ) const
inline

Returns true if this body is simulating, false if it is fixed (kinematic)

◆ IsNonKinematic()

bool FBodyInstance::IsNonKinematic ( ) const

Returns true if the body is non kinematic

◆ IsPartialIslandSleepAllowed()

bool FBodyInstance::IsPartialIslandSleepAllowed ( ) const
inline

◆ IsPhysicsDisabled()

bool FBodyInstance::IsPhysicsDisabled ( ) const

◆ IsShapeBoundToBody()

bool FBodyInstance::IsShapeBoundToBody ( const FPhysicsShapeHandle Shape) const

Check if the shape is owned by this body instance

◆ IsSolverAsyncDeltaTimeSet()

bool FBodyInstance::IsSolverAsyncDeltaTimeSet ( ) const
inline

◆ IsUsingMACD()

bool FBodyInstance::IsUsingMACD ( ) const
inline

◆ IsValidBodyInstance()

bool FBodyInstance::IsValidBodyInstance ( ) const

See if this body is valid.

◆ LineTrace()

bool FBodyInstance::LineTrace ( struct FHitResult OutHit,
const FVector Start,
const FVector End,
bool  bTraceComplex,
bool  bReturnPhysicalMaterial = false 
) const

Trace a ray against just this bodyinstance

Parameters
OutHitInformation about hit against this component, if true is returned
StartStart location of the ray
EndEnd location of the ray
bTraceComplexShould we trace against complex or simple collision of this body
bReturnPhysicalMaterialFill in the PhysMaterial field of OutHit
Returns
true if a hit is found

◆ LoadProfileData()

void FBodyInstance::LoadProfileData ( bool  bVerifyProfile)

Update profile data if required

Parameters
bVerifyProfile - if true, it makes sure it has correct set up with current profile, if false, it overwrites from profile data (for backward compatibility)

◆ OnCalculateCustomProjection()

FCalculateCustomProjection & FBodyInstance::OnCalculateCustomProjection ( )

Returns reference to the OnCalculateCustomProjection delegate. Will allocate delegate struct if not already created.

◆ OnRecalculatedMassProperties()

FRecalculatedMassProperties & FBodyInstance::OnRecalculatedMassProperties ( )

Returns reference to the OnRecalculatedMassProperties delegate. Will allocate delegate struct if not already created.

◆ OverlapMulti() [1/2]

bool FBodyInstance::OverlapMulti ( TArray< struct FOverlapResult > &  InOutOverlaps,
const class UWorld World,
const FTransform pWorldToComponent,
const FVector Pos,
const FQuat Rot,
ECollisionChannel  TestChannel,
const struct FComponentQueryParams Params,
const struct FCollisionResponseParams ResponseParams,
const FCollisionObjectQueryParams ObjectQueryParams = FCollisionObjectQueryParams::DefaultObjectQueryParam 
) const

Determines the set of components that this body instance would overlap with at the supplied location/rotation

Note
The overload taking rotation as an FQuat is slightly faster than the version using FRotator (which will be converted to an FQuat)..
Parameters
InOutOverlapsArray of overlaps found between this component in specified pose and the world (new overlaps will be appended, the array is not cleared!)
WorldWorld to use for overlap test
pWorldToComponentUsed to convert the body instance world space position into local space before teleporting it to (Pos, Rot) [optional, use when the body instance isn't centered on the component instance]
PosLocation to place the component's geometry at to test against the world
RotRotation to place components' geometry at to test against the world
TestChannelThe 'channel' that this ray is in, used to determine which components to hit
Params
ResponseParams
ObjectQueryParamsList of object types it's looking for. When this enters, we do object query with component shape
Returns
TRUE if OutOverlaps contains any blocking results

◆ OverlapMulti() [2/2]

bool FBodyInstance::OverlapMulti ( TArray< struct FOverlapResult > &  InOutOverlaps,
const class UWorld World,
const FTransform pWorldToComponent,
const FVector Pos,
const FRotator Rot,
ECollisionChannel  TestChannel,
const struct FComponentQueryParams Params,
const struct FCollisionResponseParams ResponseParams,
const FCollisionObjectQueryParams ObjectQueryParams = FCollisionObjectQueryParams::DefaultObjectQueryParam 
) const

◆ OverlapTest()

bool FBodyInstance::OverlapTest ( const FVector Position,
const FQuat Rotation,
const struct FCollisionShape CollisionShape,
FMTDResult OutMTD = nullptr,
bool  bTraceComplex = false 
) const

Test if the bodyinstance overlaps with the specified shape at the specified position/rotation

Parameters
PositionPosition to place the shape at before testing
RotationRotation to apply to the shape before testing
CollisionShapeShape to test against
OutMTDThe minimum translation direction needed to push the shape out of this BodyInstance. (Optional)
TraceComplexTrace against complex or simple geometry (Defaults simple)
Returns
true if the geometry associated with this body instance overlaps the query shape at the specified location/rotation

◆ OverlapTest_AssumesLocked()

bool FBodyInstance::OverlapTest_AssumesLocked ( const FVector Position,
const FQuat Rotation,
const struct FCollisionShape CollisionShape,
FMTDResult OutMTD = nullptr,
bool  bTraceComplex = false 
) const

Test if the bodyinstance overlaps with the specified shape at the specified position/rotation Note: This function is not thread safe. Make sure you obtain the physics scene read lock before calling it

Parameters
PositionPosition to place the shape at before testing
RotationRotation to apply to the shape before testing
CollisionShapeShape to test against
OutMTDThe minimum translation direction needed to push the shape out of this BodyInstance. (Optional)
TraceComplexTrace against complex or simple geometry (Defaults simple)
Returns
true if the geometry associated with this body instance overlaps the query shape at the specified location/rotation

◆ OverlapTestForBodies()

bool FBodyInstance::OverlapTestForBodies ( const FVector Position,
const FQuat Rotation,
const TArray< FBodyInstance * > &  Bodies,
bool  bTraceComplex = false 
) const
inline

Test if the bodyinstance overlaps with the specified body instances

Parameters
PositionPosition to place our shapes at before testing (shapes of this BodyInstance)
RotationRotation to apply to our shapes before testing (shapes of this BodyInstance)
BodiesThe bodies we are testing for overlap with. These bodies will be in world space already
TraceComplexTrace against complex or simple geometry (Defaults simple)
Returns
true if any of the bodies passed in overlap with this

◆ OverlapTestForBodiesImpl()

template<typename AllocatorType >
bool FBodyInstance::OverlapTestForBodiesImpl ( const FVector Pos,
const FQuat Rot,
const TArray< FBodyInstance *, AllocatorType > &  Bodies,
bool  bTraceComplex 
) const

◆ OverlapTestForBody()

bool FBodyInstance::OverlapTestForBody ( const FVector Position,
const FQuat Rotation,
FBodyInstance Body,
bool  bTraceComplex = false 
) const
inline

◆ PostShapeChange()

void FBodyInstance::PostShapeChange ( )

After adding/removing shapes call this function to update mass distribution etc...

◆ PutInstanceToSleep()

void FBodyInstance::PutInstanceToSleep ( )

Force this body to sleep

◆ ReleasePhysicsActor()

void FBodyInstance::ReleasePhysicsActor ( )

◆ ReplaceResponseToChannels()

bool FBodyInstance::ReplaceResponseToChannels ( ECollisionResponse  OldResponse,
ECollisionResponse  NewResponse 
)

Replace the channels on this body matching the old response with the new response

◆ ResolveDOFMode()

EDOFMode::Type FBodyInstance::ResolveDOFMode ( EDOFMode::Type  DOFMode)
static

◆ SerializeState()

void FBodyInstance::SerializeState ( Chaos::FSerializedDataBuffer OutSerializedState,
Chaos::ESerializedDataContext  DataContext 
)

Serialized out the physics thread state of this body as an array of bytes

◆ SetAllowPartialIslandSleep()

void FBodyInstance::SetAllowPartialIslandSleep ( bool  bInAllowPartialIslandSleep)

[EXPERIMENTAL] Enable/disable Partial Island Sleeping for the entire island this body is in. Partial Island Sleeping permits the solver to freeze the body's dynamics ("sleep") if it has not moved significantly in the previous simulation frames even if connected bodies are still moving. The body will be unfrozen ("wake up") due to several possible triggers such as the detection of new collisions, creation of new constraints, and user interactions.

◆ SetAngularVelocityInRadians()

void FBodyInstance::SetAngularVelocityInRadians ( const FVector NewAngVel,
bool  bAddToCurrent,
bool  bAutoWake = true 
)

Set the angular velocity of this body

◆ SetBodyTransform()

void FBodyInstance::SetBodyTransform ( const FTransform NewTransform,
ETeleportType  Teleport,
bool  bAutoWake = true 
)

Move the physics body to a new pose.

Parameters
bTeleportIf true, no velocity is inferred on the kinematic body from this movement, but it moves right away.

◆ SetCollisionEnabled()

void FBodyInstance::SetCollisionEnabled ( ECollisionEnabled::Type  NewType,
bool  bUpdatePhysicsFilterData = true 
)

Controls what kind of collision is enabled for this body and allows optional disable physics rebuild

◆ SetCollisionProfileName()

void FBodyInstance::SetCollisionProfileName ( FName  InCollisionProfileName)

Set Collision Profile Name This function should be called outside of constructors to set profile name. This will change current CollisionProfileName to be this, and overwrite Collision Setting

Parameters
InCollisionProfileName: New Profile Name

◆ SetCollisionProfileNameDeferred()

void FBodyInstance::SetCollisionProfileNameDeferred ( FName  InCollisionProfileName)

Set Collision Profile Name (deferred) This function is called by constructors when they set ProfileName This will change current CollisionProfileName, but collision data will not be set up until the physics state is created or the collision profile is accessed.

Parameters
InCollisionProfileName: New Profile Name

◆ SetContactModification()

void FBodyInstance::SetContactModification ( bool  bNewContactModification)

Enables/disables contact modification

◆ SetContactReportForceThreshold()

ENGINE_API void FBodyInstance::SetContactReportForceThreshold ( float  Threshold)

Set a new contact report force threhold. Threshold < 0 disables this feature.

◆ SetDOFLock()

void FBodyInstance::SetDOFLock ( EDOFMode::Type  NewDOFMode)

Locks physical movement along axis.

◆ SetEnableGravity()

void FBodyInstance::SetEnableGravity ( bool  bGravityEnabled)

Enables/disables whether this body is affected by gravity.

◆ SetGravityGroupIndex()

void FBodyInstance::SetGravityGroupIndex ( int32  NewGravityGroupIndex)

Sets the gravity group index, which determines acceleration when gravity is enabled.

◆ SetGyroscopicTorqueEnabled()

void FBodyInstance::SetGyroscopicTorqueEnabled ( bool  bInGyroscopicTorqueEnabled)

Enabled/disables whether this body is affected by gyroscopic torque, mainly useful for long/thin objects that spin

◆ SetInertiaConditioningEnabled()

void FBodyInstance::SetInertiaConditioningEnabled ( bool  bEnabled)

Enable or disable inertia conditionin.

See also
bInertiaConditioning

◆ SetInstanceNotifyRBCollision()

void FBodyInstance::SetInstanceNotifyRBCollision ( bool  bNewNotifyCollision)

Set whether we should get a notification about physics collisions

◆ SetInstanceSimulatePhysics()

void FBodyInstance::SetInstanceSimulatePhysics ( bool  bSimulate,
bool  bMaintainPhysicsBlending = false,
bool  bPreserveExistingAttachment = false 
)

Set this body to either simulate or to be fixed/kinematic.

Parameters
bMaintainPhysicsBlendingIf true then the physics blend weight will not be adjusted. If false then it will get set to 0 or 1 depending on bSimulate.
bPreserveExistingAttachmentsIf true then any existing attachment between the owning component and its parent will be preserved, even when switching to simulate (most likely useful for skeletal meshes that are parented to a moveable component). If false then the owning component will be detached from its parent if this is the root body and it is being set to simulate.

◆ SetLinearVelocity()

void FBodyInstance::SetLinearVelocity ( const FVector NewVel,
bool  bAddToCurrent,
bool  bAutoWake = true 
)

Set the linear velocity of this body

◆ SetMaskFilter()

void FBodyInstance::SetMaskFilter ( FMaskFilter  InMaskFilter)

Updates the mask filter.

◆ SetMassOverride()

void FBodyInstance::SetMassOverride ( float  MassInKG,
bool  bNewOverrideMass = true 
)

Sets the mass override

◆ SetMassScale()

void FBodyInstance::SetMassScale ( float  InMassScale = 1.f)

Modify the mass scale of this body

◆ SetMassSpaceLocal()

void FBodyInstance::SetMassSpaceLocal ( const FTransform NewMassSpaceLocalTM)

TODO: this only works at runtime when the physics state has been created. Any changes that result in recomputing mass properties will not properly remember this

◆ SetMaxAngularVelocityInRadians()

void FBodyInstance::SetMaxAngularVelocityInRadians ( float  NewMaxAngVel,
bool  bAddToCurrent,
bool  bUpdateOverrideMaxAngularVelocity = true 
)

Set the maximum angular velocity of this body

◆ SetMaxDepenetrationVelocity()

void FBodyInstance::SetMaxDepenetrationVelocity ( float  MaxVelocity)

Set the maximum velocity used to depenetrate this object from others when spawned with initial overlaps or teleports (does not affect overlaps as a result of normal movement). A value of zero will allow objects that are spawned overlapping to go to sleep as they are rather than pop out of each other. Note: implicitly calls SetOverrideMaxDepenetrationVelocity(true) Note: MaxDepenetration overrides the CollisionInitialOverlapDepenetrationVelocity project setting (and not the MaxDepenetrationVelocity solver setting that will be deprecated)

◆ SetObjectType()

void FBodyInstance::SetObjectType ( ECollisionChannel  Channel)

Set the movement channel of this body to the one supplied

◆ SetOneWayInteraction()

void FBodyInstance::SetOneWayInteraction ( bool  InOneWayInteraction = true)

If set to true, this body will treat bodies that do not have the flag set as having infinite mass

◆ SetOverrideIterationCounts()

void FBodyInstance::SetOverrideIterationCounts ( bool  bOverride)

◆ SetOverrideMaxDepenetrationVelocity()

void FBodyInstance::SetOverrideMaxDepenetrationVelocity ( bool  bInEnabled)

Enable/Disable override of MaxDepenetrationVelocity

◆ SetPhysicsActor()

void FBodyInstance::SetPhysicsActor ( FPhysicsActorHandle  InHandle)

◆ SetPhysicsActorHandle()

void FBodyInstance::SetPhysicsActorHandle ( FPhysicsActorHandle  InHandle)
inline

◆ SetPhysicsDisabled()

void FBodyInstance::SetPhysicsDisabled ( bool  bSetDisabled)

Disable/Re-Enable this body in the solver, when disable, the body won't be part of the simulation ( regardless if it's dynamic or kinematic ) and no collision will occur this can be used for performance control situation for example

◆ SetPhysMaterialOverride()

void FBodyInstance::SetPhysMaterialOverride ( class UPhysicalMaterial NewPhysMaterial)

Set physical material override for this body

Changes the current PhysMaterialOverride for this body. Note that if physics is already running on this component, this will not alter its mass/inertia etc, it will only change its surface properties like friction and the damping.

◆ SetPositionSolverIterationCount()

void FBodyInstance::SetPositionSolverIterationCount ( uint8  PositionSolverIterationCountIn)

◆ SetProjectionSolverIterationCount()

void FBodyInstance::SetProjectionSolverIterationCount ( uint8  ProjectionSolverIterationCountIn)

◆ SetResponseToAllChannels()

bool FBodyInstance::SetResponseToAllChannels ( ECollisionResponse  NewResponse)

Set the response of this body to all channels

◆ SetResponseToChannel()

bool FBodyInstance::SetResponseToChannel ( ECollisionChannel  Channel,
ECollisionResponse  NewResponse 
)

Set the collision response of this body to a particular channel

◆ SetResponseToChannels()

bool FBodyInstance::SetResponseToChannels ( const FCollisionResponseContainer NewResponses)

Set the response of this body to the supplied settings

◆ SetShapeCollisionEnabled()

void FBodyInstance::SetShapeCollisionEnabled ( const int32  ShapeIndex,
ECollisionEnabled::Type  NewType,
bool  bUpdatePhysicsFilterData = true 
)

Controls what kind of collision is enabled for a particular shape

◆ SetShapeResponseToChannels()

bool FBodyInstance::SetShapeResponseToChannels ( const int32  ShapeIndex,
const FCollisionResponseContainer NewResponses 
)

Set the response of a specific shape on this body to the supplied settings

◆ SetSmoothEdgeCollisionsEnabled()

void FBodyInstance::SetSmoothEdgeCollisionsEnabled ( bool  bNewSmoothEdgeCollisions)

Enables/disabled smoothed edge collisions

◆ SetSolverAsyncDeltaTime()

void FBodyInstance::SetSolverAsyncDeltaTime ( const float  NewSolverAsyncDeltaTime)
inline

◆ SetUpdateKinematicFromSimulation()

void FBodyInstance::SetUpdateKinematicFromSimulation ( bool  bUpdateKinematicFromSimulation)

Enables/disables whether this body, when kinematic, is updated from the simulation rather than when setting the kinematic target.

◆ SetUseCCD()

void FBodyInstance::SetUseCCD ( bool  bInUseCCD)

Enable/disable Continuous Collision Detection feature

◆ SetUseMACD()

void FBodyInstance::SetUseMACD ( bool  bInUseMACD)

[EXPERIMENTAL] Enable/disable Motion-Aware Collision Detection feature. MACD attempts to take the movement of the body into account during collisions detection to reduce the chance of objects passing through each other at moderate speeds without the need for CCD. CCD is still required reliable collision between high-speed objects.

◆ SetVelocitySolverIterationCount()

void FBodyInstance::SetVelocitySolverIterationCount ( uint8  VelocitySolverIterationCountIn)

◆ SetWalkableSlopeOverride()

void FBodyInstance::SetWalkableSlopeOverride ( const FWalkableSlopeOverride NewOverride,
bool  bNewOverideSetting = true 
)

Sets a custom slope override struct for this instance. Implicitly sets bOverrideWalkableSlopeOnInstance to true.

◆ ShouldInterpolateWhenSubStepping()

bool FBodyInstance::ShouldInterpolateWhenSubStepping ( ) const
inline

Whether we should interpolate when substepping.

See also
bInterpolateWhenSubStepping

◆ StartAsyncTermBody_GameThread()

FBodyInstance::FAsyncTermBodyPayload FBodyInstance::StartAsyncTermBody_GameThread ( )

Prepares the body to release its resources outside of the game thread.

Returns
the payload used by AsyncTermBody to release the resources.

◆ Sweep()

bool FBodyInstance::Sweep ( struct FHitResult OutHit,
const FVector Start,
const FVector End,
const FQuat ShapeWorldRotation,
const FCollisionShape Shape,
bool  bTraceComplex 
) const

Trace a shape against just this bodyinstance

Parameters
OutHitInformation about hit against this component, if true is returned
StartStart location of the box
EndEnd location of the box
ShapeWorldRotationThe rotation applied to the collision shape in world space.
CollisionShapeCollision Shape
bTraceComplexShould we trace against complex or simple collision of this body
Returns
true if a hit is found

◆ TermBody()

void FBodyInstance::TermBody ( bool  bNeverDeferRelease = false)

Terminates the body, releasing resources

Parameters
bNeverDeferReleaseIn some cases orphaned actors can have their internal release deferred. If this isn't desired this flag will override that behavior

Clean up the physics engine info for this instance.

◆ UnWeld()

void FBodyInstance::UnWeld ( FBodyInstance Body)

Takes a welded body and unwelds it. This function does not create the new body, it only removes the old one

◆ UpdateBodyScale()

bool FBodyInstance::UpdateBodyScale ( const FVector InScale3D,
bool  bForceUpdate = false 
)

Update Body Scale

Parameters
InScale3DNew Scale3D. If that's different from previous Scale3D, it will update Body scale.
bForceUpdateWill refresh shape dimensions from BodySetup, even if scale has not changed.
Returns
true if succeed

◆ UpdateDampingProperties()

void FBodyInstance::UpdateDampingProperties ( )

Update instance's linear and angular damping

◆ UpdateInstanceSimulatePhysics()

void FBodyInstance::UpdateInstanceSimulatePhysics ( )

Makes sure the current kinematic state matches the simulate flag

◆ UpdateInterpolateWhenSubStepping()

void FBodyInstance::UpdateInterpolateWhenSubStepping ( )
protected

Update the substepping interpolation flag

◆ UpdateMassProperties()

void FBodyInstance::UpdateMassProperties ( )

Update instance's mass properties (mass, inertia and center-of-mass offset) based on MassScale, InstanceMassScale and COMNudge.

◆ UpdatePhysicalMaterials()

void FBodyInstance::UpdatePhysicalMaterials ( )

Update the instance's material properties (friction, restitution)

◆ UpdatePhysicsFilterData()

void FBodyInstance::UpdatePhysicsFilterData ( )

Update the instances collision filtering data

Update the filter data on the physics shapes, based on the owning component flags.

◆ UpdateTriMeshVertices()

void FBodyInstance::UpdateTriMeshVertices ( const TArray< FVector > &  NewPositions)

Dynamically update the vertices of per-poly collision for this body.

◆ UPROPERTY()

FBodyInstance::UPROPERTY ( EditAnywhere  ,
BlueprintReadOnly  ,
Category  = Physics,
meta  = (editcondition="bOverrideMass", ClampMin="0.001", UIMin="0.001", DisplayName="Mass (kg)") 
)
protected

Mass of the body in KG. By default we compute this based on physical material and mass scale.

See also
bOverrideMass to set this directly

◆ UseExternalCollisionProfile()

void FBodyInstance::UseExternalCollisionProfile ( UBodySetup InExternalCollisionProfileBodySetup)

Use the collision profile found in the given BodySetup's default BodyInstance

◆ ValidateTransform()

bool FBodyInstance::ValidateTransform ( const FTransform Transform,
const FString &  DebugName,
const UBodySetup Setup 
)
static

Validate a body transform, outputting debug info

Parameters
TransformTransform to debug
DebugNameName of the instance for logging
SetupBody setup for this instance

◆ WakeInstance()

void FBodyInstance::WakeInstance ( )

Wake this body

◆ Weld()

bool FBodyInstance::Weld ( FBodyInstance Body,
const FTransform RelativeTM 
)

Takes two body instances and welds them together to create a single simulated rigid body. Returns true if success.

Friends And Related Symbol Documentation

◆ Chaos::Private::FInitBodiesHelperBaseInternal

◆ FBodyInstanceCustomization

friend class FBodyInstanceCustomization
friend

◆ FBodyInstanceCustomizationHelper

friend class FBodyInstanceCustomizationHelper
friend

◆ FBodySetupDetails

friend class FBodySetupDetails
friend

◆ FFoliageTypeCustomizationHelpers

friend class FFoliageTypeCustomizationHelpers
friend

◆ FUpdateCollisionResponseHelper

friend struct FUpdateCollisionResponseHelper
friend

◆ operator<<

ENGINE_API FArchive & operator<< ( FArchive Ar,
FBodyInstance BodyInst 
)
friend

◆ UCollisionProfile

friend class UCollisionProfile
friend

◆ UPhysicsAsset

friend class UPhysicsAsset
friend

Member Data Documentation

◆ ActorHandle

FPhysicsActorHandle FBodyInstance::ActorHandle

◆ AngularDamping

float FBodyInstance::AngularDamping

'Drag' force added to reduce angular movement

◆ bContactModification

uint8 FBodyInstance::bContactModification

Enable contact modification. Assumes custom contact modification has been provided (see FPhysXContactModifyCallback)

◆ bHACK_DisableCollisionResponse

uint8 FBodyInstance::bHACK_DisableCollisionResponse

@HACK: These are ONLY used when the 'p.EnableDynamicPerBodyFilterHacks' CVar is set (disabled by default). Some games need to dynamically modify collision per skeletal body. These provide game code a way to do that, until we're able to refactor how skeletal bodies work.

◆ bHACK_DisableSkelComponentFilterOverriding

uint8 FBodyInstance::bHACK_DisableSkelComponentFilterOverriding

◆ bIgnoreAnalyticCollisions

uint8 FBodyInstance::bIgnoreAnalyticCollisions

If true ignore analytic collisions and treat objects as a general implicit surface

◆ bInertiaConditioning

uint8 FBodyInstance::bInertiaConditioning
protected

Enable automatic inertia conditioning to stabilize constraints.

Inertia conditioning increases inertia when an object is long and thin and also when it has joints that are outside the collision shapes of the body. Increasing the inertia reduces the amount of rotation applied at joints which helps stabilize joint chains, especially when bodies are small. In principle you can get the same behaviour by setting the InertiaTensorScale appropriately, but this takes some of the guesswork out of it.

Note
This only changes the inertia used in the low-level solver. That inertia is not visible to the BodyInstance which will still report the inertia calculated from the mass, shapes, and InertiaTensorScale.
When enabled, the effective inertia depends on the joints attached to the body so the inertia will change when joints are added or removed (automatically - no user action required).

◆ bInterpolateWhenSubStepping

uint8 FBodyInstance::bInterpolateWhenSubStepping
protected

Internal flag to allow us to quickly check whether we should interpolate when substepping e.g. kinematic bodies that are QueryOnly do not need to interpolate as we will not be querying them at a sub-position. This is complicated by welding, where multiple the CollisionEnabled flag of the root must be considered.

◆ bLockRotation

uint8 FBodyInstance::bLockRotation

When a Locked Axis Mode is selected, will lock rotation to the specified axis

◆ bLockTranslation

uint8 FBodyInstance::bLockTranslation

When a Locked Axis Mode is selected, will lock translation on the specified axis

◆ bLockXRotation

uint8 FBodyInstance::bLockXRotation

Lock rotation about the X-axis

◆ bLockXTranslation

uint8 FBodyInstance::bLockXTranslation

Lock translation along the X-axis

◆ bLockYRotation

uint8 FBodyInstance::bLockYRotation

Lock rotation about the Y-axis

◆ bLockYTranslation

uint8 FBodyInstance::bLockYTranslation

Lock translation along the Y-axis

◆ bLockZRotation

uint8 FBodyInstance::bLockZRotation

Lock rotation about the Z-axis

◆ bLockZTranslation

uint8 FBodyInstance::bLockZTranslation

Lock translation along the Z-axis

◆ bNotifyRigidBodyCollision

uint8 FBodyInstance::bNotifyRigidBodyCollision

Should 'Hit' events fire when this object collides during physics simulation.

◆ BodyInstanceOwner

IPhysicsBodyInstanceOwner* FBodyInstance::BodyInstanceOwner

Owner containing this body (when not a UPrimitiveComponent).

◆ bOneWayInteraction

uint8 FBodyInstance::bOneWayInteraction
protected

If set to true, this body will treat bodies that do not have the flag set as having infinite mass

◆ bOverrideIterationCounts

uint8 FBodyInstance::bOverrideIterationCounts
protected

Enable per-body iterations counts

◆ bOverrideMaxAngularVelocity

uint8 FBodyInstance::bOverrideMaxAngularVelocity

Override the default max angular velocity

◆ bOverrideMaxDepenetrationVelocity

uint8 FBodyInstance::bOverrideMaxDepenetrationVelocity
protected

Whether this body instance has its own custom MaxDepenetrationVelocity

◆ bOverrideSolverAsyncDeltaTime

uint8 FBodyInstance::bOverrideSolverAsyncDeltaTime

Set the desired delta time for the body.

◆ bOverrideWalkableSlopeOnInstance

uint8 FBodyInstance::bOverrideWalkableSlopeOnInstance
protected

Whether this instance of the object has its own custom walkable slope override setting.

◆ bPendingCollisionProfileSetup

uint8 FBodyInstance::bPendingCollisionProfileSetup
protected

Whether we are pending a collision profile setup

◆ bSmoothEdgeCollisions

uint8 FBodyInstance::bSmoothEdgeCollisions

Remove unnecessary edge collisions to allow smooth sliding over surfaces composed of multiple actors/components. This is fairly expensive and should only be enabled on hero objects.

◆ bUseCCD

uint8 FBodyInstance::bUseCCD

If true Continuous Collision Detection (CCD) will be used for this component

◆ COMNudge

FVector FBodyInstance::COMNudge

User specified offset for this object's Center of Mass. The offset is defined in bone space and will be added to the calculated location.

◆ CurrentSceneState

BodyInstanceSceneState FBodyInstance::CurrentSceneState

◆ CustomDOFPlaneNormal

FVector FBodyInstance::CustomDOFPlaneNormal

Locks physical movement along a custom plane for a given normal.

◆ CustomSleepThresholdMultiplier

float FBodyInstance::CustomSleepThresholdMultiplier

If the SleepFamily is set to custom, multiply the natural sleep threshold by this amount. A higher number will cause the body to sleep sooner.

◆ DOFConstraint

FConstraintInstance* FBodyInstance::DOFConstraint

Constraint used to allow for easy DOF setup per bodyinstance

◆ DOFMode

TEnumAsByte<EDOFMode::Type> FBodyInstance::DOFMode

Locks physical movement along specified axis.

◆ ExternalCollisionProfileBodySetup

TWeakObjectPtr<UBodySetup> FBodyInstance::ExternalCollisionProfileBodySetup
protected

The body setup holding the default body instance and its collision profile.

◆ GravityGroupIndex

uint8 FBodyInstance::GravityGroupIndex

What gravity group the BI should use, which determines rate of acceleration

◆ InertiaTensorScale

FVector FBodyInstance::InertiaTensorScale

Per-instance scaling of inertia (bigger number means it'll be harder to rotate)

◆ InstanceBodyIndex

int32 FBodyInstance::InstanceBodyIndex

Index of this BodyInstance within the SkeletalMeshComponent/PhysicsAsset. Is INDEX_NONE if a single body component

◆ InstanceBoneIndex

int16 FBodyInstance::InstanceBoneIndex

When we are a body within a SkeletalMeshComponent, we cache the index of the bone we represent, to speed up sync'ing physics to anim.

◆ LinearDamping

float FBodyInstance::LinearDamping

'Drag' force added to reduce linear movement

◆ MassScale

float FBodyInstance::MassScale

Per-instance scaling of mass

◆ MaxAngularVelocity

float FBodyInstance::MaxAngularVelocity

The maximum angular velocity for this instance [degrees/s]

◆ MaxDepenetrationVelocity

float FBodyInstance::MaxDepenetrationVelocity
protected

The maximum velocity used to depenetrate this object from others when spawned or teleported with initial overlaps (does not affect overlaps as a result of normal movement). A value of zero will allow objects that are spawned overlapping to go to sleep without moving rather than pop out of each other. E.g., use zero if you spawn dynamic rocks partially embedded in the ground and want them to be interactive but not pop out of the ground when touched. A negative value is equivalent to bOverrideMaxDepenetrationVelocity = false, meaning use the project setting. This overrides the CollisionInitialOverlapDepenetrationVelocity project setting on a per-body basis (and not the MaxDepenetrationVelocity solver setting that will be deprecated).

◆ OwnerComponent

TWeakObjectPtr<class UPrimitiveComponent> FBodyInstance::OwnerComponent

PrimitiveComponent containing this body, if relevant.

◆ PhysicsBlendWeight

float FBodyInstance::PhysicsBlendWeight

Influence of rigid body physics (blending) on the mesh's pose (0.0 == use only animation, 1.0 == use only physics) Provide appropriate interface for doing this instead of allowing BlueprintReadWrite

◆ PhysicsUserData

FPhysicsUserData FBodyInstance::PhysicsUserData

◆ PhysMaterialOverride

TObjectPtr<class UPhysicalMaterial> FBodyInstance::PhysMaterialOverride
protected

Allows you to override the PhysicalMaterial to use for simple collision on this body.

◆ PositionSolverIterationCount

uint8 FBodyInstance::PositionSolverIterationCount

Override the project-settings position iteration count for this body (if bOverrideIterationCounts is set). Increasing this will be more CPU intensive, but better stabilized. 0 will lead to unresolved penetration and no static friction.

◆ ProjectionSolverIterationCount

uint8 FBodyInstance::ProjectionSolverIterationCount

Override the project-settings projection iteration count for this body (if bOverrideIterationCounts is set). Usually 0 or 1.

◆ Scale3D

FVector FBodyInstance::Scale3D

Current scale of physics - used to know when and how physics must be rescaled to match current transform of OwnerComponent.

◆ SleepFamily

ESleepFamily FBodyInstance::SleepFamily

The set of values used in considering when put this body to sleep.

◆ SolverAsyncDeltaTime

float FBodyInstance::SolverAsyncDeltaTime

Override value for physics solver async delta time. With multiple actors specifying this, the solver will use the smallest delta time

◆ SourceObject

TWeakObjectPtr<UObject> FBodyInstance::SourceObject

Source object for this body. If OwnerComponent is not null, this will typically be the owning actor.

◆ StabilizationThresholdMultiplier

float FBodyInstance::StabilizationThresholdMultiplier

Stabilization factor for this body if Physics stabilization is enabled. A higher number will cause more aggressive stabilization at the risk of loss of momentum at low speeds. A value of 0 will disable stabilization for this body.

◆ VelocitySolverIterationCount

uint8 FBodyInstance::VelocitySolverIterationCount

Override the project-settings velocity iteration count for this body (if bOverrideIterationCounts is set). Increasing this will be more CPU intensive, but better stabilized. 0 will lead to unresolved restitution and lower quality dynamic friction.

◆ WalkableSlopeOverride

struct FWalkableSlopeOverride FBodyInstance::WalkableSlopeOverride
protected

Custom walkable slope override setting for this instance.

See also
GetWalkableSlopeOverride(), SetWalkableSlopeOverride()

◆ WeldParent

FBodyInstance* FBodyInstance::WeldParent

The parent body that we are welded to


The documentation for this struct was generated from the following files: