![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <BodyInstance.h>
Inheritance diagram for FBodyInstance:Classes | |
| struct | FAsyncTermBodyPayload |
| struct | FWeldInfo |
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< UBodySetup > | ExternalCollisionProfileBodySetup |
| struct FWalkableSlopeOverride | WalkableSlopeOverride |
| TObjectPtr< class UPhysicalMaterial > | PhysMaterialOverride |
Container for a physics representation of an object
| FBodyInstance::FBodyInstance | ( | ) |
Constructor
|
default |
| void FBodyInstance::AddAngularImpulseInRadians | ( | const FVector & | Impulse, |
| bool | bVelChange, | ||
| const FAsyncPhysicsTimestamp | TimeStamp = FAsyncPhysicsTimestamp(), |
||
| APlayerController * | PlayerController = nullptr |
||
| ) |
Add a rotational impulse to this body
| 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.
| 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
| 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)
| void FBodyInstance::AddImpulse | ( | const FVector & | Impulse, |
| bool | bVelChange, | ||
| const FAsyncPhysicsTimestamp | TimeStamp = FAsyncPhysicsTimestamp(), |
||
| APlayerController * | PlayerController = nullptr |
||
| ) |
Add an impulse to this body
| 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
| 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.
| Origin | Origin of force in world space. |
| Radius | Radius within which to apply the force. |
| Strength | Strength of force to apply. |
| Falloff | Allows you to control the strength of the force as a function of distance from Origin. |
| bAccelChange | If true, Strength is taken as a change in acceleration instead of a physical force (i.e. mass will have no effect). |
| bAllowSubstepping | Whether 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 |
| 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.
| Origin | Point of origin for the radial impulse blast, in world space |
| Radius | Size of radial impulse. Beyond this distance from Origin, there will be no affect. |
| Strength | Maximum strength of impulse applied to body. |
| Falloff | Allows you to control the strength of the impulse as a function of distance from Origin. |
| bVelChange | If true, the Strength is taken as a change in velocity instead of an impulse (ie. mass will have no effect). |
| 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
| 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
| void FBodyInstance::ApplyAsyncPhysicsCommand | ( | FAsyncPhysicsTimestamp | TimeStamp, |
| const bool | bIsInternal, | ||
| APlayerController * | PlayerController, | ||
| const TFunction< void()> & | Command | ||
| ) |
Apply async physics command onto the body instance
| void FBodyInstance::ApplyDeferredCollisionProfileName | ( | ) |
Applies a deferred collision profile
| 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
|
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
| PShape | The shape we are applying the material to |
| SimplePhysMat | The material to use if a simple shape is provided (or complex materials are empty) |
| ComplexPhysMats | The array of materials to apply if a complex shape is provided |
| 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
| 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
|
static |
Releases body resources provided by Payload which was returned by StartAsyncTermBody_GameThread (can be called outside of game thread).
| Payload | body resources to release. |
|
static |
Build the flags to control which types of collision (sim and query) shapes owned by this BodyInstance should have.
| 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)
| void FBodyInstance::ClearExternalCollisionProfile | ( | ) |
Clear accumulated forces on this body
Clear accumulated torques on this body
| void FBodyInstance::CopyBodyInstancePropertiesFrom | ( | const FBodyInstance * | FromInst | ) |
Utility for copying properties from one BodyInstance to another.
| void FBodyInstance::CopyRuntimeBodyInstancePropertiesFrom | ( | const FBodyInstance * | FromInst | ) |
Utility for copying only the runtime instanced properties from one BodyInstance to another.
| void FBodyInstance::CreateDOFLock | ( | ) |
| bool FBodyInstance::DoesUseCollisionProfile | ( | ) | const |
return true if it uses Collision Profile System. False otherwise
| void FBodyInstance::DrawCOMPosition | ( | class FPrimitiveDrawInterface * | PDI, |
| float | COMRenderSize, | ||
| const FColor & | COMRenderColor | ||
| ) |
Draws the center of mass as a wire star
| void FBodyInstance::ExecuteOnCalculateCustomProjection | ( | FTransform & | WorldTM | ) | const |
Executes the OnCalculateCustomProjection delegate if bound.
| const FPhysicsActorHandle & FBodyInstance::GetActorReferenceWithWelding | ( | ) | const |
|
inline |
[EXPERIMENTAL] Whether Partial Island Sleep is permitted for the island this body is in
| 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
| FBox FBodyInstance::GetBodyBounds | ( | ) | const |
Return bounds of physics representation in world space
| FBox FBodyInstance::GetBodyBoundsLocal | ( | ) | const |
Return bounds of physics representation in world space
| FString FBodyInstance::GetBodyDebugName | ( | ) | const |
Get the name for this body, for use in debugging
| FVector FBodyInstance::GetBodyInertiaTensor | ( | ) | const |
Return the body's inertia tensor. This is returned in local mass space
|
inline |
| void FBodyInstance::GetBodyInstanceResourceSizeEx | ( | FResourceSizeEx & | CumulativeResourceSize | ) | const |
Returns memory used by resources allocated for this body instance ( ex. physics resources )
| float FBodyInstance::GetBodyMass | ( | ) | const |
Returns the body's mass
| UBodySetup * FBodyInstance::GetBodySetup | ( | ) | const |
|
inline |
Get the current type of collision enabled
| FName FBodyInstance::GetCollisionProfileName | ( | ) | const |
Returns the collision profile name that will be used.
|
inline |
| TArray< UPhysicalMaterial * > FBodyInstance::GetComplexPhysicalMaterials | ( | ) | const |
Get the complex PhysicalMaterials array for this body
|
static |
Find the correct PhysicalMaterial and PhysicalMaterialMasks for complex geometry on a given body and owner. This is really for internal use during serialization
| TArray< UPhysicalMaterial * > FBodyInstance::GetComplexPhysicalMaterials | ( | TArray< FPhysicalMaterialMaskParams > & | OutPhysMaterialMasks | ) | const |
Get the complex PhysicalMaterials and PhysicalMaterialMasks array for this body
| void FBodyInstance::GetComplexPhysicalMaterials | ( | TArray< UPhysicalMaterial * > & | OutPhysMaterials | ) | const |
Get the complex PhysicalMaterials for this body
| void FBodyInstance::GetComplexPhysicalMaterials | ( | TArray< UPhysicalMaterial * > & | OutPhysMaterials, |
| TArray< FPhysicalMaterialMaskParams > & | OutPhysMaterialMasks | ||
| ) | const |
Get the complex PhysicalMaterials and PhysicalMaterialMasks for this body
|
inline |
Returns the center of mass of this body (in world space)
| const TMap< FPhysicsShapeHandle, FBodyInstance::FWeldInfo > * FBodyInstance::GetCurrentWeldInfo | ( | ) | 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
| Point | Point in world space |
| OutPointOnBody | Point on the surface of body closest to Point |
| 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
| 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
| FVector FBodyInstance::GetLockedAxis | ( | ) | const |
|
inline |
Return the ignore mask filter.
|
inline |
Returns the mass override. See MassInKgOverride for documentation
| FTransform FBodyInstance::GetMassSpaceLocal | ( | ) | const |
Returns the mass coordinate system to local space transform (position is local center of mass, rotation should be identity)
| FTransform FBodyInstance::GetMassSpaceToWorldSpace | ( | ) | const |
Returns the mass coordinate system to world space transform (position is world center of mass, rotation is world inertia orientation)
| float FBodyInstance::GetMaxAngularVelocityInRadians | ( | ) | const |
Get the maximum angular velocity of this body
|
inline |
The maximum velocity at which initally-overlapping bodies will separate. Does not affect normal contact resolution.
|
inline |
Get the movement channel of this body
| const FBodyInstance * FBodyInstance::GetOriginalBodyInstance | ( | const FPhysicsShapeHandle & | InShape | ) | const |
Returns the original owning body instance. This is needed for welding
|
inline |
Are we overriding the MaxDepenetrationVelocity. See SetMaxDepenetrationVelocity
| bool FBodyInstance::GetOverrideWalkableSlopeOnInstance | ( | ) | const |
Gets bOverrideWalkableSlopeOnInstance
| FPhysicsActorHandle FBodyInstance::GetPhysicsActor | ( | ) | const |
| FPhysicsActorHandle & FBodyInstance::GetPhysicsActorHandle | ( | ) |
| const FPhysicsActorHandle & FBodyInstance::GetPhysicsActorHandle | ( | ) | const |
| FPhysicsActorHandle FBodyInstance::GetPhysicsActorWeldRoot | ( | ) | const |
| EPhysicsReplicationMode FBodyInstance::GetPhysicsReplicationMode | ( | ) | const |
Get the EPhysicsReplicationMode from the owning actor. It's recommended to get the parameter directly from the Actor if possible.
| FPhysScene * FBodyInstance::GetPhysicsScene | ( | ) |
Get the scene that owns this body.
| const FPhysScene * FBodyInstance::GetPhysicsScene | ( | ) | const |
|
inline |
Get physical material override for this body
|
inline |
|
inline |
| const FTransform & FBodyInstance::GetRelativeBodyTransform | ( | const FPhysicsShapeHandle & | InShape | ) | const |
Returns the relative transform between root body and welded instance owned by the shape.
|
inline |
Get the collision response of this body to a particular channel
|
inline |
Get Collision ResponseToChannels container for this component
| bool FBodyInstance::GetRigidBodyState | ( | FRigidBodyState & | OutState | ) |
| ECollisionEnabled::Type FBodyInstance::GetShapeCollisionEnabled | ( | const int32 | ShapeIndex | ) | const |
Get the current type of collision enabled for a particular shape
| const FCollisionResponseContainer & FBodyInstance::GetShapeResponseToChannels | ( | const int32 | ShapeIndex | ) | const |
Get Collision ResponseToChannels container for a specific shape in this component
| const FCollisionResponseContainer & FBodyInstance::GetShapeResponseToChannels | ( | const int32 | ShapeIndex, |
| const FCollisionResponseContainer & | DefaultResponseContainer | ||
| ) | const |
| UPhysicalMaterial * FBodyInstance::GetSimplePhysicalMaterial | ( | ) | const |
Find the correct PhysicalMaterial for simple geometry on this body
|
static |
Find the correct PhysicalMaterial for simple geometry on a given body and owner. This is really for internal use during serialization
| float FBodyInstance::GetSleepThresholdMultiplier | ( | ) | const |
Gets the multiplier to the threshold where the body will go to sleep automatically.
|
inline |
| 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
| Point | Point in world space |
| OutDistanceSquared | How far from the instance the point is. 0 if inside the shape |
| OutPointOnBody | Point on the surface of body closest to Point |
| FVector FBodyInstance::GetUnrealWorldAngularVelocityInRadians | ( | ) | const |
Get current angular velocity in world space from physics body.
Note: returns angular velocity in radians per second.
| FVector FBodyInstance::GetUnrealWorldAngularVelocityInRadians_AssumesLocked | ( | ) | const |
Get current angular velocity in world space from physics body.
Note: returns angular velocity in radians per second.
| FTransform FBodyInstance::GetUnrealWorldTransform | ( | bool | bWithProjection = true, |
| bool | bForceGlobalPose = false |
||
| ) | const |
Get current transform in world space from physics body.
| FTransform FBodyInstance::GetUnrealWorldTransform_AssumesLocked | ( | bool | bWithProjection = true, |
| bool | bForceGlobalPose = false |
||
| ) | const |
Get current transform in world space from physics body.
| FVector FBodyInstance::GetUnrealWorldVelocity | ( | ) | const |
Get current velocity in world space from physics body.
| FVector FBodyInstance::GetUnrealWorldVelocity_AssumesLocked | ( | ) | const |
Get current velocity in world space from physics body.
Get current velocity of a point on this physics body, in world space. Point is specified in world space.
Get current velocity of a point on this physics body, in world space. Point is specified in world space.
|
inline |
[EXPERIMENTAL] Whether Motion-Aware Collision Detection is enabled
|
inline |
| 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.
|
inline |
| 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
| Setup | The setup to use to create the body |
| Transform | Transform of the body |
| PrimComp | The owning component |
| InRBScene | The physics scene to place the body into |
| SpawnParams | The parameters for determining certain spawn behavior |
| BodyInstanceOwner | The owning object of the body instance (optional and only used if PrimComp is not set) |
| 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
| Setup | The setup to use to create the body |
| Transform | Transform of the body |
| PrimComp | The owning component |
| SourceObject | The source object. If null and PrimComp is not null, it will be set to the owning actor. |
| InRBScene | The physics scene to place the body into |
| SpawnParams | The parameters for determining certain spawn behavior |
| BodyInstanceOwner | The owning object of the body instance (optional and only used if PrimComp is not set) |
| 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
|
static |
Standalone path to batch initialize large amounts of static bodies, which will be deferred till the next scene update for fast scene addition.
| Bodies | |
| Transforms | |
| BodySetup | |
| PrimitiveComp | |
| InRBScene |
|
static |
Standalone path to batch initialize large amounts of static bodies. Note that this function will steal Bodies and Transforms arrays.
| Bodies | The list of BodyInstances to initialize. |
| Transforms | The list of BodyInstance transform |
| BodySetup | The BodySetup to use |
| PrimitiveComp | The associated primitive component |
| InRBScene | The associated physics scene |
| BodyInstanceOwner | The associated owning object of the body instance (optional and only used if PrimitiveComp is not set) |
| bool FBodyInstance::IsDynamic | ( | ) | const |
Returns true if the body is not static
|
inline |
Whether inertia conditioning is enabled.
| bool FBodyInstance::IsInstanceAwake | ( | ) | const |
Returns whether this body is awake
|
inline |
Returns true if this body is simulating, false if it is fixed (kinematic)
| bool FBodyInstance::IsNonKinematic | ( | ) | const |
Returns true if the body is non kinematic
|
inline |
| bool FBodyInstance::IsPhysicsDisabled | ( | ) | const |
| bool FBodyInstance::IsShapeBoundToBody | ( | const FPhysicsShapeHandle & | Shape | ) | const |
Check if the shape is owned by this body instance
|
inline |
|
inline |
| bool FBodyInstance::IsValidBodyInstance | ( | ) | const |
See if this body is valid.
| 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
| OutHit | Information about hit against this component, if true is returned |
| Start | Start location of the ray |
| End | End location of the ray |
| bTraceComplex | Should we trace against complex or simple collision of this body |
| bReturnPhysicalMaterial | Fill in the PhysMaterial field of OutHit |
Update profile data if required
| bVerifyProfile - if true, it makes sure it has correct set up with current profile, if false, it overwrites from profile data (for backward compatibility) |
| FCalculateCustomProjection & FBodyInstance::OnCalculateCustomProjection | ( | ) |
Returns reference to the OnCalculateCustomProjection delegate. Will allocate delegate struct if not already created.
| FRecalculatedMassProperties & FBodyInstance::OnRecalculatedMassProperties | ( | ) |
Returns reference to the OnRecalculatedMassProperties delegate. Will allocate delegate struct if not already created.
| 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
| InOutOverlaps | Array of overlaps found between this component in specified pose and the world (new overlaps will be appended, the array is not cleared!) |
| World | World to use for overlap test |
| pWorldToComponent | Used 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] |
| Pos | Location to place the component's geometry at to test against the world |
| Rot | Rotation to place components' geometry at to test against the world |
| TestChannel | The 'channel' that this ray is in, used to determine which components to hit |
| Params | |
| ResponseParams | |
| ObjectQueryParams | List of object types it's looking for. When this enters, we do object query with component shape |
| 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 |
| 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
| Position | Position to place the shape at before testing |
| Rotation | Rotation to apply to the shape before testing |
| CollisionShape | Shape to test against |
| OutMTD | The minimum translation direction needed to push the shape out of this BodyInstance. (Optional) |
| TraceComplex | Trace against complex or simple geometry (Defaults simple) |
| 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
| Position | Position to place the shape at before testing |
| Rotation | Rotation to apply to the shape before testing |
| CollisionShape | Shape to test against |
| OutMTD | The minimum translation direction needed to push the shape out of this BodyInstance. (Optional) |
| TraceComplex | Trace against complex or simple geometry (Defaults simple) |
|
inline |
Test if the bodyinstance overlaps with the specified body instances
| Position | Position to place our shapes at before testing (shapes of this BodyInstance) |
| Rotation | Rotation to apply to our shapes before testing (shapes of this BodyInstance) |
| Bodies | The bodies we are testing for overlap with. These bodies will be in world space already |
| TraceComplex | Trace against complex or simple geometry (Defaults simple) |
| bool FBodyInstance::OverlapTestForBodiesImpl | ( | const FVector & | Pos, |
| const FQuat & | Rot, | ||
| const TArray< FBodyInstance *, AllocatorType > & | Bodies, | ||
| bool | bTraceComplex | ||
| ) | const |
|
inline |
| void FBodyInstance::PostShapeChange | ( | ) |
After adding/removing shapes call this function to update mass distribution etc...
| void FBodyInstance::PutInstanceToSleep | ( | ) |
Force this body to sleep
| void FBodyInstance::ReleasePhysicsActor | ( | ) |
| bool FBodyInstance::ReplaceResponseToChannels | ( | ECollisionResponse | OldResponse, |
| ECollisionResponse | NewResponse | ||
| ) |
Replace the channels on this body matching the old response with the new response
|
static |
| void FBodyInstance::SerializeState | ( | Chaos::FSerializedDataBuffer & | OutSerializedState, |
| Chaos::ESerializedDataContext | DataContext | ||
| ) |
Serialized out the physics thread state of this body as an array of bytes
[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.
| void FBodyInstance::SetAngularVelocityInRadians | ( | const FVector & | NewAngVel, |
| bool | bAddToCurrent, | ||
| bool | bAutoWake = true |
||
| ) |
Set the angular velocity of this body
| void FBodyInstance::SetBodyTransform | ( | const FTransform & | NewTransform, |
| ETeleportType | Teleport, | ||
| bool | bAutoWake = true |
||
| ) |
Move the physics body to a new pose.
| bTeleport | If true, no velocity is inferred on the kinematic body from this movement, but it moves right away. |
| 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
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
| InCollisionProfileName | : New Profile Name |
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.
| InCollisionProfileName | : New Profile Name |
Enables/disables contact modification
| ENGINE_API void FBodyInstance::SetContactReportForceThreshold | ( | float | Threshold | ) |
Set a new contact report force threhold. Threshold < 0 disables this feature.
| void FBodyInstance::SetDOFLock | ( | EDOFMode::Type | NewDOFMode | ) |
Locks physical movement along axis.
Enables/disables whether this body is affected by gravity.
Sets the gravity group index, which determines acceleration when gravity is enabled.
Enabled/disables whether this body is affected by gyroscopic torque, mainly useful for long/thin objects that spin
Enable or disable inertia conditionin.
Set whether we should get a notification about physics collisions
| void FBodyInstance::SetInstanceSimulatePhysics | ( | bool | bSimulate, |
| bool | bMaintainPhysicsBlending = false, |
||
| bool | bPreserveExistingAttachment = false |
||
| ) |
Set this body to either simulate or to be fixed/kinematic.
| bMaintainPhysicsBlending | If true then the physics blend weight will not be adjusted. If false then it will get set to 0 or 1 depending on bSimulate. |
| bPreserveExistingAttachments | If 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. |
| void FBodyInstance::SetLinearVelocity | ( | const FVector & | NewVel, |
| bool | bAddToCurrent, | ||
| bool | bAutoWake = true |
||
| ) |
Set the linear velocity of this body
| void FBodyInstance::SetMaskFilter | ( | FMaskFilter | InMaskFilter | ) |
Updates the mask filter.
Sets the mass override
| 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
| void FBodyInstance::SetMaxAngularVelocityInRadians | ( | float | NewMaxAngVel, |
| bool | bAddToCurrent, | ||
| bool | bUpdateOverrideMaxAngularVelocity = true |
||
| ) |
Set the maximum angular velocity of this body
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)
| void FBodyInstance::SetObjectType | ( | ECollisionChannel | Channel | ) |
Set the movement channel of this body to the one supplied
If set to true, this body will treat bodies that do not have the flag set as having infinite mass
Enable/Disable override of MaxDepenetrationVelocity
| void FBodyInstance::SetPhysicsActor | ( | FPhysicsActorHandle | InHandle | ) |
|
inline |
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
| 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.
| bool FBodyInstance::SetResponseToAllChannels | ( | ECollisionResponse | NewResponse | ) |
Set the response of this body to all channels
| bool FBodyInstance::SetResponseToChannel | ( | ECollisionChannel | Channel, |
| ECollisionResponse | NewResponse | ||
| ) |
Set the collision response of this body to a particular channel
| bool FBodyInstance::SetResponseToChannels | ( | const FCollisionResponseContainer & | NewResponses | ) |
Set the response of this body to the supplied settings
| void FBodyInstance::SetShapeCollisionEnabled | ( | const int32 | ShapeIndex, |
| ECollisionEnabled::Type | NewType, | ||
| bool | bUpdatePhysicsFilterData = true |
||
| ) |
Controls what kind of collision is enabled for a particular shape
| bool FBodyInstance::SetShapeResponseToChannels | ( | const int32 | ShapeIndex, |
| const FCollisionResponseContainer & | NewResponses | ||
| ) |
Set the response of a specific shape on this body to the supplied settings
Enables/disabled smoothed edge collisions
Enables/disables whether this body, when kinematic, is updated from the simulation rather than when setting the kinematic target.
Enable/disable Continuous Collision Detection feature
[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.
| void FBodyInstance::SetWalkableSlopeOverride | ( | const FWalkableSlopeOverride & | NewOverride, |
| bool | bNewOverideSetting = true |
||
| ) |
Sets a custom slope override struct for this instance. Implicitly sets bOverrideWalkableSlopeOnInstance to true.
|
inline |
Whether we should interpolate when substepping.
| FBodyInstance::FAsyncTermBodyPayload FBodyInstance::StartAsyncTermBody_GameThread | ( | ) |
Prepares the body to release its resources outside of the game thread.
| 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
| OutHit | Information about hit against this component, if true is returned |
| Start | Start location of the box |
| End | End location of the box |
| ShapeWorldRotation | The rotation applied to the collision shape in world space. |
| CollisionShape | Collision Shape |
| bTraceComplex | Should we trace against complex or simple collision of this body |
Terminates the body, releasing resources
| bNeverDeferRelease | In 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.
| 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
Update Body Scale
| InScale3D | New Scale3D. If that's different from previous Scale3D, it will update Body scale. |
| bForceUpdate | Will refresh shape dimensions from BodySetup, even if scale has not changed. |
| void FBodyInstance::UpdateDampingProperties | ( | ) |
Update instance's linear and angular damping
| void FBodyInstance::UpdateInstanceSimulatePhysics | ( | ) |
Makes sure the current kinematic state matches the simulate flag
|
protected |
Update the substepping interpolation flag
| void FBodyInstance::UpdateMassProperties | ( | ) |
Update instance's mass properties (mass, inertia and center-of-mass offset) based on MassScale, InstanceMassScale and COMNudge.
| void FBodyInstance::UpdatePhysicalMaterials | ( | ) |
Update the instance's material properties (friction, restitution)
| void FBodyInstance::UpdatePhysicsFilterData | ( | ) |
Update the instances collision filtering data
Update the filter data on the physics shapes, based on the owning component flags.
Dynamically update the vertices of per-poly collision for this body.
|
protected |
Mass of the body in KG. By default we compute this based on physical material and mass scale.
| void FBodyInstance::UseExternalCollisionProfile | ( | UBodySetup * | InExternalCollisionProfileBodySetup | ) |
Use the collision profile found in the given BodySetup's default BodyInstance
|
static |
Validate a body transform, outputting debug info
| Transform | Transform to debug |
| DebugName | Name of the instance for logging |
| Setup | Body setup for this instance |
| void FBodyInstance::WakeInstance | ( | ) |
Wake this body
| 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.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
| FPhysicsActorHandle FBodyInstance::ActorHandle |
| float FBodyInstance::AngularDamping |
'Drag' force added to reduce angular movement
| uint8 FBodyInstance::bContactModification |
Enable contact modification. Assumes custom contact modification has been provided (see FPhysXContactModifyCallback)
| 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.
| uint8 FBodyInstance::bHACK_DisableSkelComponentFilterOverriding |
| uint8 FBodyInstance::bIgnoreAnalyticCollisions |
If true ignore analytic collisions and treat objects as a general implicit surface
|
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.
|
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.
| uint8 FBodyInstance::bLockRotation |
When a Locked Axis Mode is selected, will lock rotation to the specified axis
| uint8 FBodyInstance::bLockTranslation |
When a Locked Axis Mode is selected, will lock translation on the specified axis
| uint8 FBodyInstance::bLockXRotation |
Lock rotation about the X-axis
| uint8 FBodyInstance::bLockXTranslation |
Lock translation along the X-axis
| uint8 FBodyInstance::bLockYRotation |
Lock rotation about the Y-axis
| uint8 FBodyInstance::bLockYTranslation |
Lock translation along the Y-axis
| uint8 FBodyInstance::bLockZRotation |
Lock rotation about the Z-axis
| uint8 FBodyInstance::bLockZTranslation |
Lock translation along the Z-axis
| uint8 FBodyInstance::bNotifyRigidBodyCollision |
Should 'Hit' events fire when this object collides during physics simulation.
| IPhysicsBodyInstanceOwner* FBodyInstance::BodyInstanceOwner |
Owner containing this body (when not a UPrimitiveComponent).
|
protected |
If set to true, this body will treat bodies that do not have the flag set as having infinite mass
|
protected |
Enable per-body iterations counts
| uint8 FBodyInstance::bOverrideMaxAngularVelocity |
Override the default max angular velocity
|
protected |
Whether this body instance has its own custom MaxDepenetrationVelocity
| uint8 FBodyInstance::bOverrideSolverAsyncDeltaTime |
Set the desired delta time for the body.
|
protected |
Whether this instance of the object has its own custom walkable slope override setting.
|
protected |
Whether we are pending a collision profile setup
| 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.
| uint8 FBodyInstance::bUseCCD |
If true Continuous Collision Detection (CCD) will be used for this component
| 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.
| BodyInstanceSceneState FBodyInstance::CurrentSceneState |
| FVector FBodyInstance::CustomDOFPlaneNormal |
Locks physical movement along a custom plane for a given normal.
| 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.
| FConstraintInstance* FBodyInstance::DOFConstraint |
Constraint used to allow for easy DOF setup per bodyinstance
| TEnumAsByte<EDOFMode::Type> FBodyInstance::DOFMode |
Locks physical movement along specified axis.
|
protected |
The body setup holding the default body instance and its collision profile.
| uint8 FBodyInstance::GravityGroupIndex |
What gravity group the BI should use, which determines rate of acceleration
| FVector FBodyInstance::InertiaTensorScale |
Per-instance scaling of inertia (bigger number means it'll be harder to rotate)
| int32 FBodyInstance::InstanceBodyIndex |
Index of this BodyInstance within the SkeletalMeshComponent/PhysicsAsset. Is INDEX_NONE if a single body component
| 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.
| float FBodyInstance::LinearDamping |
'Drag' force added to reduce linear movement
| float FBodyInstance::MassScale |
Per-instance scaling of mass
| float FBodyInstance::MaxAngularVelocity |
The maximum angular velocity for this instance [degrees/s]
|
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).
| TWeakObjectPtr<class UPrimitiveComponent> FBodyInstance::OwnerComponent |
PrimitiveComponent containing this body, if relevant.
| 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
| FPhysicsUserData FBodyInstance::PhysicsUserData |
|
protected |
Allows you to override the PhysicalMaterial to use for simple collision on this body.
| 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.
| uint8 FBodyInstance::ProjectionSolverIterationCount |
Override the project-settings projection iteration count for this body (if bOverrideIterationCounts is set). Usually 0 or 1.
| FVector FBodyInstance::Scale3D |
Current scale of physics - used to know when and how physics must be rescaled to match current transform of OwnerComponent.
| ESleepFamily FBodyInstance::SleepFamily |
The set of values used in considering when put this body to sleep.
| float FBodyInstance::SolverAsyncDeltaTime |
Override value for physics solver async delta time. With multiple actors specifying this, the solver will use the smallest delta time
| TWeakObjectPtr<UObject> FBodyInstance::SourceObject |
Source object for this body. If OwnerComponent is not null, this will typically be the owning actor.
| 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.
| 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.
|
protected |
Custom walkable slope override setting for this instance.
| FBodyInstance* FBodyInstance::WeldParent |
The parent body that we are welded to