UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PhysicsPublic.h File Reference
#include "CoreMinimal.h"
#include "Stats/Stats.h"
#include "Engine/EngineTypes.h"
#include "Misc/CoreMisc.h"
#include "Misc/App.h"
#include "EngineDefines.h"
#include "PhysicsInterfaceDeclaresCore.h"
#include "PhysicsPublicCore.h"

Go to the source code of this file.

Classes

struct  FRigidBodyCollisionInfo
 
struct  FCollisionNotifyInfo
 
class  FPhysCommandHandler
 
class  FKCachedConvexDataElement
 
class  FKCachedConvexData
 
struct  FKCachedPerTriData
 
class  FKConvexGeomRenderInfo
 
class  FPhysicsDelegates
 

Namespaces

namespace  PhysCommand
 

Enumerations

enum  PhysCommand::Type {
  PhysCommand::Release , PhysCommand::ReleasePScene , PhysCommand::DeleteCPUDispatcher , PhysCommand::DeleteSimEventCallback ,
  PhysCommand::DeleteContactModifyCallback , PhysCommand::DeleteCCDContactModifyCallback , PhysCommand::DeleteMbpBroadphaseCallback , PhysCommand::Max
}
 

Functions

 DECLARE_DELEGATE_TwoParams (FCalculateCustomPhysics, float, FBodyInstance *)
 
 DECLARE_DELEGATE_TwoParams (FCalculateCustomProjection, const FBodyInstance *, FTransform &)
 
 DECLARE_MULTICAST_DELEGATE_OneParam (FRecalculatedMassProperties, FBodyInstance *)
 
 DECLARE_CYCLE_STAT_EXTERN (TEXT("FetchAndStart Time (all)"), STAT_TotalPhysicsTime, STATGROUP_Physics,)
 
 DECLARE_DWORD_COUNTER_STAT_EXTERN (TEXT("Cloth Actor Count"), STAT_NumCloths, STATGROUP_Physics, ENGINE_API)
 
 DECLARE_DWORD_COUNTER_STAT_EXTERN (TEXT("Simulated Cloth Verts"), STAT_NumClothVerts, STATGROUP_Physics, ENGINE_API)
 
void ClearForces_AssumesLocked (FBodyInstance *BodyInstance, bool bAllowSubstepping)
 
void ClearTorques_AssumesLocked (FBodyInstance *BodyInstance, bool bAllowSubstepping)
 
bool PhysSingleThreadedMode ()
 
ENGINE_API bool InitGamePhys ()
 
ENGINE_API void TermGamePhys ()
 
ENGINE_API void DeferredPhysResourceCleanup ()
 
FTransform FindBodyTransform (AActor *Actor, FName BoneName)
 
FBox FindBodyBox (AActor *Actor, FName BoneName)
 

Variables

ENGINE_API class FPhysCommandHandlerGPhysCommandHandler
 

Function Documentation

◆ ClearForces_AssumesLocked()

void ClearForces_AssumesLocked ( FBodyInstance BodyInstance,
bool  bAllowSubstepping 
)

Clears all linear forces on the body

◆ ClearTorques_AssumesLocked()

void ClearTorques_AssumesLocked ( FBodyInstance BodyInstance,
bool  bAllowSubstepping 
)

Clears all torques on the body

◆ DECLARE_CYCLE_STAT_EXTERN()

DECLARE_CYCLE_STAT_EXTERN ( TEXT("FetchAndStart Time (all)")  ,
STAT_TotalPhysicsTime  ,
STATGROUP_Physics   
)

Physics stats

◆ DECLARE_DELEGATE_TwoParams() [1/2]

DECLARE_DELEGATE_TwoParams ( FCalculateCustomPhysics  ,
float  ,
FBodyInstance  
)

Delegate for applying custom physics forces upon the body. Can be passed to "AddCustomPhysics" so custom forces and torques can be calculated individually for every physics substep. The function provides delta time for a physics step and pointer to body instance upon which forces must be added.

Do not expect this callback to be called from the main game thread! It may get called from a physics simulation thread.

◆ DECLARE_DELEGATE_TwoParams() [2/2]

DECLARE_DELEGATE_TwoParams ( FCalculateCustomProjection  ,
const FBodyInstance ,
FTransform  
)

Delegate for applying custom physics projection upon the body. When this is set for the body instance, it will be called whenever component transformation is requested from the physics engine. If projection is required (for example, visual position of an object must be different to the one in physics engine, e.g. the box should not penetrate the wall visually) the transformation of body must be updated to account for it. Since this could be called many times by GetWorldTransform any expensive computations should be cached if possible.

◆ DECLARE_DWORD_COUNTER_STAT_EXTERN() [1/2]

DECLARE_DWORD_COUNTER_STAT_EXTERN ( TEXT("Cloth Actor Count" ,
STAT_NumCloths  ,
STATGROUP_Physics  ,
ENGINE_API   
)

◆ DECLARE_DWORD_COUNTER_STAT_EXTERN() [2/2]

DECLARE_DWORD_COUNTER_STAT_EXTERN ( TEXT("Simulated Cloth Verts" ,
STAT_NumClothVerts  ,
STATGROUP_Physics  ,
ENGINE_API   
)

◆ DECLARE_MULTICAST_DELEGATE_OneParam()

DECLARE_MULTICAST_DELEGATE_OneParam ( FRecalculatedMassProperties  ,
FBodyInstance  
)

Delegate for when the mass properties of a body instance have been re-calculated. This can be useful for systems that need to set specific physx settings on actors, or systems that rely on the mass information in some way

◆ DeferredPhysResourceCleanup()

ENGINE_API void DeferredPhysResourceCleanup ( )

Perform any deferred cleanup of resources (GPhysXPendingKillConvex etc)

Perform any cleanup of physics engine resources. This is deferred because when closing down the game, you want to make sure you are not destroying a mesh after the physics SDK has been shut down.

◆ FindBodyBox()

FBox FindBodyBox ( AActor Actor,
FName  BoneName 
)

◆ FindBodyTransform()

FTransform FindBodyTransform ( AActor Actor,
FName  BoneName 
)

◆ InitGamePhys()

ENGINE_API bool InitGamePhys ( )

◆ PhysSingleThreadedMode()

bool PhysSingleThreadedMode ( )
inline

Return true if we should be running in single threaded mode, ala dedicated server

◆ TermGamePhys()

ENGINE_API void TermGamePhys ( )

Variable Documentation

◆ GPhysCommandHandler

ENGINE_API class FPhysCommandHandler* GPhysCommandHandler
extern

Pointer to PhysX Command Handler