class

PhysicsWorld

Module
Physics
Header
#include "Physics/PhysicsWorld.h"
Namespace
Mowo

Constructors

SignatureNameDescription
PhysicsWorld()PhysicsWorld
~PhysicsWorld()~PhysicsWorld
PhysicsWorld(const PhysicsWorld&) = deletePhysicsWorld

Public functions

ReturnsNameDescription
PhysicsWorld&operator=
voidInitialize
voidShutdown
voidStep
voidStepAsyncThe async tick (p.AsyncTick).
voidWaitForStep
boolIsStepInFlight
floatGetLastAsyncStepMs
uint64_tGetAsyncJoinStalls
FPhysicsWorldImpl&GetImplPhysics-internal: the Jolt side of this world, joined first like every other entry point.
voidAddForceForce / Impulse / Torque (operate on dynamic bodies)
voidAddImpulse
voidAddTorque
voidAddForceAtPosition
voidAddImpulseAtPosition
voidSetPersistentForcePersistent per-body force/torque channel.
voidSetPersistentTorque
voidAddPersistentForce
voidAddPersistentForceAtPosition
voidAddPersistentTorque
voidClearPersistentForce
voidClearPersistentForces
voidSetLinearVelocity
voidSetAngularVelocity
Vec3GetLinearVelocity
Vec3GetAngularVelocity
voidSetBodyFrictionLive friction / restitution on an existing body — what swapping a physics material at runtime changes.
voidSetBodyRestitution
floatGetBodyFriction
floatGetBodyRestitution
boolRaycastQueries.
boolRaycastAll
boolSphereCast
boolBoxCast
boolCapsuleCast
boolRaycastChannelTrace-channel raycast.
std::vector<FPhysicsBodyId>OverlapSphereOverlap queries.
std::vector<FPhysicsBodyId>OverlapBox
boolQueryRayThe first-class query surface: channel or layer filtering, an ignore LIST, mobility and sensor gating, multi-hit with per-hit Block/Overlap, and entity resolution on the way out.
boolQueryRayMulti
boolQuerySweep
boolQuerySweepMulti
boolQueryOverlap
boolQueryRayAnyExistence tests: stop at the first body that qualifies instead of finding the closest, which is all "is anything in the way" ever needs.
boolQuerySweepAny
boolQueryOverlapAny
boolQueryPointEvery body whose shape contains the point.
uint32_tExecuteRayBatchThe engine behind FTraceBatch: one filter construction, one narrow-phase lookup and one job dispatch for the whole ray set.
voidSetBodyEntityBody → entity mirror.
voidClearBodyEntity
uint64_tGetBodyEntity
ESurfaceTypeGetSurfaceAtSurface type at a specific point on a body.
ESurfaceTypeGetSurface
boolIsBodySleeping
voidWakeUpBody
voidPutBodyToSleep
boolIsBodyAddedWhether the body is in the simulation right now (a disabled RigidBody's body exists but is removed).
FPhysicsBodyIdCreateBodyA body owned by the caller rather than by a component; the caller destroys it with DestroyBody.
FPhysicsBodyIdCreateStaticMeshBodyA static triangle mesh in world space (indices are triangle triples).
voidDestroyBody
FPhysicsBodyIdCreateBodyFromShapeA body around a shape that was built elsewhere (usually on a worker): no shape work happens on the calling thread.
std::vector<FPhysicsBodyId>CreateBodiesFromShapesMany bodies in one go.
FPhysicsBodyIdCreateVoxelChunkBodyA static chunk of solid voxels (see FVoxelColliderDesc): ray, shape and character casts query the bit grid, no triangles are made.
std::vector<FPhysicsBodyId>CreateVoxelChunkBodiesThe batched form, one id per chunk.
boolUpdateVoxelChunkSwaps the solid set of a chunk body after an edit: a new bit grid goes on the existing body, the broad phase bounds follow, nothing is remeshed.
voidOptimizeBroadPhaseRebuilds the broad phase after a batch of bodies was added in one go — what a level load does, so a test or a tool that just placed static geometry queries against the same tree a running game would.
voidSetGravity
Vec3GetGravity
uint32_tGetVelocityStepsWhat the solver actually runs with, read back from Jolt.
uint32_tGetPositionSteps
FPhysicsBodyIdCreateKinematicAnchorBody
voidDestroyAnchorBody
voidMoveKinematicBody
FPhysicsConstraintHandleCreatePositionMotorConstraint
voidRemoveHoldConstraint
FPhysicsConstraintHandleCreateHingeConstraintConstraint creation for gameplay (doors, levers, sliding parts).
FPhysicsConstraintHandleCreateSliderConstraint
voidRemoveConstraint
floatGetHingeAngle
voidSetHingeMotorTargetHolds the hinge at an angle (rad).
voidSetHingeMotorVelocityDrives the hinge at a constant rate (rad/s) instead of toward an angle — a turntable, a conveyor drum, a wheel that must keep spinning.
voidSetHingeMotorOff
voidSetSixDofMotorSpringsSprings for every position motor of a 6DOF joint.
voidWakeConstraintBodiesActivates the non-static bodies of a two-body constraint.
floatGetSliderPosition
voidSetBodyObjectLayer
voidSetBodyRotation
boolGetBodyPoseOrigin pose of a body; false for an invalid or removed one.
boolSaveStateThe whole simulation state — every body's pose, velocity and sleep state, constraint lambdas and the contact cache that warm-starts the next step — as bytes, and back.
boolRestoreState
uint64_tComputeStateChecksumHash of SaveState: two worlds fed the same inputs agree on it exactly when they simulated identically (meaningful under p.Deterministic).
boolGetBodyStatePartial snapshots for the bodies one peer owns.
boolApplyBodyState
voidCaptureBodyStates
uint32_tApplyBodyStatesApplies each state to the binding with the same key; returns how many matched.
voidTeleportBodyMoves a body without waking it or touching its velocity.
Vec3GetBodyCenterOfMass
voidSetMotionType
EPhysicsMotionTypeGetMotionTypeStatic for an invalid body.
boolHasContactSensorRecordWhether the contact listener still holds a sensor record for this body index — diagnostic; index reuse would misroute the next body's exit events if teardown forgot one.
const PhysicsConfig&GetConfig
PhysicsDebugSettings&GetDebugSettingsGetDebugSettings() returns a writable reference so the editor can flip checkboxes without going through setters.
const PhysicsDebugSettings&GetDebugSettings
const PhysicsStats&GetStatsSnapshot of body / constraint counts + step timing.
voidRefreshStats
voidDrawDebugWalks every body via the locking interface and submits lines to the engine's DebugDraw.

Function details

PhysicsWorld

C++
PhysicsWorld()

~PhysicsWorld

C++
~PhysicsWorld()

PhysicsWorld

C++
PhysicsWorld(const PhysicsWorld&) = delete

operator=

C++
PhysicsWorld& operator=(const PhysicsWorld&) = delete

Initialize

C++
void Initialize(const PhysicsConfig& config = PhysicsConfig())

Shutdown

C++
void Shutdown()

Step

C++
void Step(float deltaTime)

StepAsync

C++
void StepAsync(float deltaTime, uint32_t stepCount)

The async tick (p.AsyncTick). StepAsync hands stepCount fixed steps to the worker pool and returns at once; WaitForStep joins them. Between the two, Jolt belongs to the job: every entry point below that reaches it joins first (counted in GetAsyncJoinStalls, so a project can see which caller keeps forfeiting the overlap), and the only read surface that does not wait is what PhysicsSystem copied out at the previous join — transforms, the interpolation snapshot, the character components, the contact events. The persistent-load channel is safe to write throughout: the job consumes the copy it was handed at submit.

WaitForStep

C++
void WaitForStep() const

IsStepInFlight

C++
bool IsStepInFlight() const

GetLastAsyncStepMs

C++
float GetLastAsyncStepMs() const

GetAsyncJoinStalls

C++
uint64_t GetAsyncJoinStalls() const

GetImpl

C++
FPhysicsWorldImpl& GetImpl() const

Physics-internal: the Jolt side of this world, joined first like every other entry point. The type is only complete inside the Physics module.

AddForce

C++
void AddForce(FPhysicsBodyId bodyID, Vec3 force)

Force / Impulse / Torque (operate on dynamic bodies)

AddImpulse

C++
void AddImpulse(FPhysicsBodyId bodyID, Vec3 impulse)

AddTorque

C++
void AddTorque(FPhysicsBodyId bodyID, Vec3 torque)

AddForceAtPosition

C++
void AddForceAtPosition(FPhysicsBodyId bodyID, Vec3 force, Vec3 position)

AddImpulseAtPosition

C++
void AddImpulseAtPosition(FPhysicsBodyId bodyID, Vec3 impulse, Vec3 position)

SetPersistentForce

C++
void SetPersistentForce(FPhysicsBodyId bodyID, Vec3 force)

Persistent per-body force/torque channel. Jolt clears accumulated forces after every Update, so a force applied once per frame reaches only the FIRST substep of a multi-substep frame — everything after it integrates force-free. Loads registered here are re-applied at the top of every Step, making the effect substep-count independent. The channel is re-armed each frame: PhysicsSystem clears it after its substep loop, so per-frame sources (buoyancy, wind) just Add every tick. Direct PhysicsWorld steppers own the clearing themselves. One-shot impulses stay on AddImpulse.

SetPersistentTorque

C++
void SetPersistentTorque(FPhysicsBodyId bodyID, Vec3 torque)

AddPersistentForce

C++
void AddPersistentForce(FPhysicsBodyId bodyID, Vec3 force)

AddPersistentForceAtPosition

C++
void AddPersistentForceAtPosition(FPhysicsBodyId bodyID, Vec3 force, Vec3 position)

AddPersistentTorque

C++
void AddPersistentTorque(FPhysicsBodyId bodyID, Vec3 torque)

ClearPersistentForce

C++
void ClearPersistentForce(FPhysicsBodyId bodyID)

ClearPersistentForces

C++
void ClearPersistentForces()

SetLinearVelocity

C++
void SetLinearVelocity(FPhysicsBodyId bodyID, Vec3 velocity)

SetAngularVelocity

C++
void SetAngularVelocity(FPhysicsBodyId bodyID, Vec3 velocity)

GetLinearVelocity

C++
Vec3 GetLinearVelocity(FPhysicsBodyId bodyID) const

GetAngularVelocity

C++
Vec3 GetAngularVelocity(FPhysicsBodyId bodyID) const

SetBodyFriction

C++
void SetBodyFriction(FPhysicsBodyId bodyID, float friction)

Live friction / restitution on an existing body — what swapping a physics material at runtime changes. The contact listener combines these per contact, so the next contact already uses the new values. The surface type lives on the shape and is not changed here.

SetBodyRestitution

C++
void SetBodyRestitution(FPhysicsBodyId bodyID, float restitution)

GetBodyFriction

C++
float GetBodyFriction(FPhysicsBodyId bodyID) const

GetBodyRestitution

C++
float GetBodyRestitution(FPhysicsBodyId bodyID) const

Raycast

C++
bool Raycast(Vec3 origin, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

Queries. ignoreBody drops one body from the result set — pass the querying entity's own body so a character does not detect itself.

RaycastAll

C++
bool RaycastAll(Vec3 origin, Vec3 dir, float maxDist, std::vector<RaycastHit>& hits, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

SphereCast

C++
bool SphereCast(Vec3 origin, float radius, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

BoxCast

C++
bool BoxCast(Vec3 center, Vec3 halfExtents, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

CapsuleCast

C++
bool CapsuleCast(Vec3 origin, float radius, float halfHeight, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

RaycastChannel

C++
bool RaycastChannel(Vec3 origin, Vec3 dir, float maxDist, ECollisionChannel traceChannel, RaycastHit& hit, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

Trace-channel raycast. Independent of object collision: a body registers a hit only when its response to traceChannel is Block. Bodies that Ignore or Overlap the channel are passed through, so a Visibility trace skips a collider that physically blocks a Pawn. Bodies with no registered response default to Block (hit), matching the plain layer raycast.

OverlapSphere

C++
std::vector<FPhysicsBodyId> OverlapSphere(Vec3 center, float radius, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

Overlap queries. These are narrow-phase shape tests: a body is reported only when its actual collision shape intersects the query volume, not merely when its broad-phase AABB does.

OverlapBox

C++
std::vector<FPhysicsBodyId> OverlapBox(Vec3 center, Vec3 halfExtents, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) const

QueryRay

C++
bool QueryRay(Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, FQueryHit& hit) const

The first-class query surface: channel or layer filtering, an ignore LIST, mobility and sensor gating, multi-hit with per-hit Block/Overlap, and entity resolution on the way out. The narrower entry points above remain for existing callers; new work goes through these. extents follows EQueryShape: sphere reads x as the radius, box reads all three as half extents, capsule reads x as the radius and y as the half height of the cylinder.

QueryRayMulti

C++
bool QueryRayMulti(Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, std::vector<FQueryHit>& hits) const

QuerySweep

C++
bool QuerySweep(EQueryShape shape, Vec3 extents, Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, FQueryHit& hit) const

QuerySweepMulti

C++
bool QuerySweepMulti(EQueryShape shape, Vec3 extents, Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, std::vector<FQueryHit>& hits) const

QueryOverlap

C++
bool QueryOverlap(EQueryShape shape, Vec3 extents, Vec3 center, const FQueryFilter& filter, std::vector<FQueryHit>& hits) const

QueryRayAny

C++
bool QueryRayAny(Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter) const

Existence tests: stop at the first body that qualifies instead of finding the closest, which is all "is anything in the way" ever needs. The overlap form is the cheap cousin of QueryOverlap for a placement or spawn check.

QuerySweepAny

C++
bool QuerySweepAny(EQueryShape shape, Vec3 extents, Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter) const

QueryOverlapAny

C++
bool QueryOverlapAny(EQueryShape shape, Vec3 extents, Vec3 center, const FQueryFilter& filter) const

QueryPoint

C++
bool QueryPoint(Vec3 point, const FQueryFilter& filter, std::vector<FQueryHit>& hits) const

Every body whose shape contains the point. Hits are unordered; the location is the point itself and the normal is zero.

ExecuteRayBatch

C++
uint32_t ExecuteRayBatch(const FTraceBatchItem* items, size_t count, const FQueryFilter& filter, FQueryHit* outHits, uint8_t* outHasHit) const

The engine behind FTraceBatch: one filter construction, one narrow-phase lookup and one job dispatch for the whole ray set. Callers that own their own storage (a scanner writing straight into its point buffer) can drive it directly; outHits and outHasHit must both hold count entries.

SetBodyEntity

C++
void SetBodyEntity(FPhysicsBodyId bodyID, uint64_t entityId)

Body → entity mirror. Query results carry the gameplay entity directly, which is what every caller wanted from a raw BodyID anyway; the batched scanner path would otherwise do one map lookup per ray. PhysicsSystem owns the registrations (rigid bodies and character inner bodies alike).

ClearBodyEntity

C++
void ClearBodyEntity(uint32_t bodyIndex)

GetBodyEntity

C++
uint64_t GetBodyEntity(uint32_t bodyIndex) const

GetSurfaceAt

C++
ESurfaceType GetSurfaceAt(FPhysicsBodyId bodyID, const FPhysicsSubShapeId& subShapeID) const

Surface type at a specific point on a body. subShapeID is what a raycast, shape cast or contact manifold hands back; pass an empty one to get the body's uniform surface. This is the single resolution path — the per-triangle and per-terrain-square answers come out of Jolt's own shape material lookup rather than a table kept alongside it.

GetSurface

C++
ESurfaceType GetSurface(FPhysicsBodyId bodyID) const

IsBodySleeping

C++
bool IsBodySleeping(FPhysicsBodyId bodyID) const

WakeUpBody

C++
void WakeUpBody(FPhysicsBodyId bodyID)

PutBodyToSleep

C++
void PutBodyToSleep(FPhysicsBodyId bodyID)

IsBodyAdded

C++
bool IsBodyAdded(FPhysicsBodyId bodyID) const

Whether the body is in the simulation right now (a disabled RigidBody's body exists but is removed).

CreateBody

C++
FPhysicsBodyId CreateBody(const FPhysicsBodyDesc& desc)

A body owned by the caller rather than by a component; the caller destroys it with DestroyBody.

CreateStaticMeshBody

C++
FPhysicsBodyId CreateStaticMeshBody(const std::vector<Vec3>& vertices, const std::vector<uint32_t>& indices, uint16_t layer = ObjectLayers::Static)

A static triangle mesh in world space (indices are triangle triples). Invalid when the mesh does not cook.

DestroyBody

C++
void DestroyBody(FPhysicsBodyId bodyID)

CreateBodyFromShape

C++
FPhysicsBodyId CreateBodyFromShape(const FPhysicsShapeBodyDesc& desc)

A body around a shape that was built elsewhere (usually on a worker): no shape work happens on the calling thread. Invalid for an invalid shape.

CreateBodiesFromShapes

C++
std::vector<FPhysicsBodyId> CreateBodiesFromShapes(const std::vector<FPhysicsShapeBodyDesc>& descs, uint32_t optimizeThreshold = 64)

Many bodies in one go. Every body is added through Jolt's AddBodiesPrepare/Finalize pair, so the broad phase takes the whole batch as one insertion instead of one tree update per body, and a batch of at least optimizeThreshold bodies ends with one OptimizeBroadPhase (the tree a trickle of static adds leaves is lopsided). The result has one id per desc, invalid where a body could not be made.

CreateVoxelChunkBody

C++
FPhysicsBodyId CreateVoxelChunkBody(const FVoxelColliderDesc& desc)

A static chunk of solid voxels (see FVoxelColliderDesc): ray, shape and character casts query the bit grid, no triangles are made.

CreateVoxelChunkBodies

C++
std::vector<FPhysicsBodyId> CreateVoxelChunkBodies(const std::vector<FVoxelColliderDesc>& descs, uint32_t optimizeThreshold = 64)

The batched form, one id per chunk.

UpdateVoxelChunk

C++
bool UpdateVoxelChunk(FPhysicsBodyId bodyID, const FVoxelColliderDesc& desc)

Swaps the solid set of a chunk body after an edit: a new bit grid goes on the existing body, the broad phase bounds follow, nothing is remeshed. False when bodyID is not a voxel chunk body.

OptimizeBroadPhase

C++
void OptimizeBroadPhase()

Rebuilds the broad phase after a batch of bodies was added in one go — what a level load does, so a test or a tool that just placed static geometry queries against the same tree a running game would.

SetGravity

C++
void SetGravity(Vec3 gravity)

GetGravity

C++
Vec3 GetGravity() const

GetVelocitySteps

C++
uint32_t GetVelocitySteps() const

What the solver actually runs with, read back from Jolt.

GetPositionSteps

C++
uint32_t GetPositionSteps() const

CreateKinematicAnchorBody

C++
FPhysicsBodyId CreateKinematicAnchorBody(Vec3 position, uint8_t layer)

DestroyAnchorBody

C++
void DestroyAnchorBody(FPhysicsBodyId bodyID)

MoveKinematicBody

C++
void MoveKinematicBody(FPhysicsBodyId bodyID, Vec3 position, float deltaTime)

CreatePositionMotorConstraint

C++
FPhysicsConstraintHandle CreatePositionMotorConstraint(FPhysicsBodyId anchorBody, FPhysicsBodyId carriedBody, Vec3 holdPoint, float frequency, float damping, float maxForce)

RemoveHoldConstraint

C++
void RemoveHoldConstraint(FPhysicsConstraintHandle constraint)

CreateHingeConstraint

C++
FPhysicsConstraintHandle CreateHingeConstraint(FPhysicsBodyId bodyID, FPhysicsBodyId otherBody, Vec3 worldPivot, Vec3 worldAxis, float limitMin, float limitMax, float maxFrictionTorque = 0.0f)

Constraint creation for gameplay (doors, levers, sliding parts). All Jolt object creation stays inside this module — Jolt's allocator globals are DLL-local, so callers in other modules must never build constraint settings themselves. Pass an invalid otherBody to attach against the immovable world. Angles are radians, points/axes world-space.

CreateSliderConstraint

C++
FPhysicsConstraintHandle CreateSliderConstraint(FPhysicsBodyId bodyID, FPhysicsBodyId otherBody, Vec3 worldPoint, Vec3 worldAxis, float limitMin, float limitMax)

RemoveConstraint

C++
void RemoveConstraint(FPhysicsConstraintHandle constraint)

GetHingeAngle

C++
float GetHingeAngle(FPhysicsConstraintHandle constraint) const

SetHingeMotorTarget

C++
void SetHingeMotorTarget(FPhysicsConstraintHandle constraint, float targetAngle, float maxTorque, float frequency = 2.0f, float damping = 1.0f)

Holds the hinge at an angle (rad). Frequency (Hz) and damping ratio describe the swing of the bodies about the hinge itself, whatever the lever between hinge and centre of mass — the rescaling to what Jolt's angle-only motor part expects happens here.

SetHingeMotorVelocity

C++
void SetHingeMotorVelocity(FPhysicsConstraintHandle constraint, float targetAngularVelocity, float maxTorque)

Drives the hinge at a constant rate (rad/s) instead of toward an angle — a turntable, a conveyor drum, a wheel that must keep spinning.

SetHingeMotorOff

C++
void SetHingeMotorOff(FPhysicsConstraintHandle constraint)

SetSixDofMotorSprings

C++
void SetSixDofMotorSprings(FPhysicsConstraintHandle constraint, float frequency, float damping)

Springs for every position motor of a 6DOF joint. Translation motors take the pair as authored; each rotation motor gets it rescaled so it describes the swing about the joint on that axis — the hinge's contract.

WakeConstraintBodies

C++
void WakeConstraintBodies(FPhysicsConstraintHandle constraint)

Activates the non-static bodies of a two-body constraint. A motor on a sleeping island does nothing — Jolt solves only active bodies — and activating a static body is a Jolt assert, so the check lives here.

GetSliderPosition

C++
float GetSliderPosition(FPhysicsConstraintHandle constraint) const

SetBodyObjectLayer

C++
void SetBodyObjectLayer(FPhysicsBodyId bodyID, uint8_t layer)

SetBodyRotation

C++
void SetBodyRotation(FPhysicsBodyId bodyID, const Quat& rotation)

GetBodyPose

C++
bool GetBodyPose(FPhysicsBodyId bodyID, Vec3& outPosition, Quat& outRotation) const

Origin pose of a body; false for an invalid or removed one.

SaveState

C++
bool SaveState(std::vector<uint8_t>& outState) const

The whole simulation state — every body's pose, velocity and sleep state, constraint lambdas and the contact cache that warm-starts the next step — as bytes, and back. What rollback netcode and time rewind restore: with the contact cache included, a restored world steps to the same bits it stepped to the first time. Restore needs the same set of bodies the state was saved with and returns false otherwise.

RestoreState

C++
bool RestoreState(const std::vector<uint8_t>& state)

ComputeStateChecksum

C++
uint64_t ComputeStateChecksum() const

Hash of SaveState: two worlds fed the same inputs agree on it exactly when they simulated identically (meaningful under p.Deterministic). Zero when the state could not be saved.

GetBodyState

C++
bool GetBodyState(FPhysicsBodyId bodyID, uint32_t key, FPhysicsBodyState& outState) const

Partial snapshots for the bodies one peer owns. GetBodyState reads a body's pose, velocities and sleep state under the caller's key; ApplyBodyState writes them back without waking a sleeping body that stays asleep. Static bodies take the pose only. Both are false for a body that is invalid or out of the simulation.

ApplyBodyState

C++
bool ApplyBodyState(FPhysicsBodyId bodyID, const FPhysicsBodyState& state)

CaptureBodyStates

C++
void CaptureBodyStates(const std::vector<FPhysicsBodyBinding>& bindings, std::vector<FPhysicsBodyState>& outStates) const

ApplyBodyStates

C++
uint32_t ApplyBodyStates(const std::vector<FPhysicsBodyBinding>& bindings, const std::vector<FPhysicsBodyState>& states)

Applies each state to the binding with the same key; returns how many matched.

TeleportBody

C++
void TeleportBody(FPhysicsBodyId bodyID, const Vec3& position, const Quat& rotation)

Moves a body without waking it or touching its velocity. Lag compensation puts bodies where they were for one query and then back, and a woken or re-integrated body would carry the rewind into the next step.

GetBodyCenterOfMass

C++
Vec3 GetBodyCenterOfMass(FPhysicsBodyId bodyID) const

SetMotionType

C++
void SetMotionType(FPhysicsBodyId bodyID, EPhysicsMotionType motionType)

GetMotionType

C++
EPhysicsMotionType GetMotionType(FPhysicsBodyId bodyID) const

Static for an invalid body.

HasContactSensorRecord

C++
bool HasContactSensorRecord(uint32_t bodyIndex) const

Whether the contact listener still holds a sensor record for this body index — diagnostic; index reuse would misroute the next body's exit events if teardown forgot one.

GetConfig

C++
const PhysicsConfig& GetConfig() const

GetDebugSettings

C++
PhysicsDebugSettings& GetDebugSettings()

GetDebugSettings() returns a writable reference so the editor can flip checkboxes without going through setters. PhysicsSystem reads the same struct once per Update tick to decide whether to call DrawDebug().

GetDebugSettings

C++
const PhysicsDebugSettings& GetDebugSettings() const

GetStats

C++
const PhysicsStats& GetStats() const

Snapshot of body / constraint counts + step timing. Refreshed by RefreshStats() — call from PhysicsSystem::Update so the values are stable for the rest of the frame.

RefreshStats

C++
void RefreshStats(float lastStepTimeMs)

DrawDebug

C++
void DrawDebug()

Walks every body via the locking interface and submits lines to the engine's DebugDraw. No-op when m_debugSettings.enabled is false. Safe to call from the main thread between physics steps.

Generated from Physics/PhysicsWorld.h via physics.json · Nov 4, 2026Version 1.0.0