PhysicsWorld
- Module
- Physics
- Header
#include "Physics/PhysicsWorld.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
PhysicsWorld() | PhysicsWorld | |
~PhysicsWorld() | ~PhysicsWorld | |
PhysicsWorld(const PhysicsWorld&) = delete | PhysicsWorld |
Public functions
| Returns | Name | Description |
|---|---|---|
PhysicsWorld& | operator= | |
void | Initialize | |
void | Shutdown | |
void | Step | |
void | StepAsync | The async tick (p.AsyncTick). |
void | WaitForStep | |
bool | IsStepInFlight | |
float | GetLastAsyncStepMs | |
uint64_t | GetAsyncJoinStalls | |
FPhysicsWorldImpl& | GetImpl | Physics-internal: the Jolt side of this world, joined first like every other entry point. |
void | AddForce | Force / Impulse / Torque (operate on dynamic bodies) |
void | AddImpulse | |
void | AddTorque | |
void | AddForceAtPosition | |
void | AddImpulseAtPosition | |
void | SetPersistentForce | Persistent per-body force/torque channel. |
void | SetPersistentTorque | |
void | AddPersistentForce | |
void | AddPersistentForceAtPosition | |
void | AddPersistentTorque | |
void | ClearPersistentForce | |
void | ClearPersistentForces | |
void | SetLinearVelocity | |
void | SetAngularVelocity | |
Vec3 | GetLinearVelocity | |
Vec3 | GetAngularVelocity | |
void | SetBodyFriction | Live friction / restitution on an existing body — what swapping a physics material at runtime changes. |
void | SetBodyRestitution | |
float | GetBodyFriction | |
float | GetBodyRestitution | |
bool | Raycast | Queries. |
bool | RaycastAll | |
bool | SphereCast | |
bool | BoxCast | |
bool | CapsuleCast | |
bool | RaycastChannel | Trace-channel raycast. |
std::vector<FPhysicsBodyId> | OverlapSphere | Overlap queries. |
std::vector<FPhysicsBodyId> | OverlapBox | |
bool | QueryRay | 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. |
bool | QueryRayMulti | |
bool | QuerySweep | |
bool | QuerySweepMulti | |
bool | QueryOverlap | |
bool | QueryRayAny | Existence tests: stop at the first body that qualifies instead of finding the closest, which is all "is anything in the way" ever needs. |
bool | QuerySweepAny | |
bool | QueryOverlapAny | |
bool | QueryPoint | Every body whose shape contains the point. |
uint32_t | ExecuteRayBatch | The engine behind FTraceBatch: one filter construction, one narrow-phase lookup and one job dispatch for the whole ray set. |
void | SetBodyEntity | Body → entity mirror. |
void | ClearBodyEntity | |
uint64_t | GetBodyEntity | |
ESurfaceType | GetSurfaceAt | Surface type at a specific point on a body. |
ESurfaceType | GetSurface | |
bool | IsBodySleeping | |
void | WakeUpBody | |
void | PutBodyToSleep | |
bool | IsBodyAdded | Whether the body is in the simulation right now (a disabled RigidBody's body exists but is removed). |
FPhysicsBodyId | CreateBody | A body owned by the caller rather than by a component; the caller destroys it with DestroyBody. |
FPhysicsBodyId | CreateStaticMeshBody | A static triangle mesh in world space (indices are triangle triples). |
void | DestroyBody | |
FPhysicsBodyId | CreateBodyFromShape | A body around a shape that was built elsewhere (usually on a worker): no shape work happens on the calling thread. |
std::vector<FPhysicsBodyId> | CreateBodiesFromShapes | Many bodies in one go. |
FPhysicsBodyId | CreateVoxelChunkBody | A static chunk of solid voxels (see FVoxelColliderDesc): ray, shape and character casts query the bit grid, no triangles are made. |
std::vector<FPhysicsBodyId> | CreateVoxelChunkBodies | The batched form, one id per chunk. |
bool | UpdateVoxelChunk | 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. |
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. |
void | SetGravity | |
Vec3 | GetGravity | |
uint32_t | GetVelocitySteps | What the solver actually runs with, read back from Jolt. |
uint32_t | GetPositionSteps | |
FPhysicsBodyId | CreateKinematicAnchorBody | |
void | DestroyAnchorBody | |
void | MoveKinematicBody | |
FPhysicsConstraintHandle | CreatePositionMotorConstraint | |
void | RemoveHoldConstraint | |
FPhysicsConstraintHandle | CreateHingeConstraint | Constraint creation for gameplay (doors, levers, sliding parts). |
FPhysicsConstraintHandle | CreateSliderConstraint | |
void | RemoveConstraint | |
float | GetHingeAngle | |
void | SetHingeMotorTarget | Holds the hinge at an angle (rad). |
void | SetHingeMotorVelocity | 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. |
void | SetHingeMotorOff | |
void | SetSixDofMotorSprings | Springs for every position motor of a 6DOF joint. |
void | WakeConstraintBodies | Activates the non-static bodies of a two-body constraint. |
float | GetSliderPosition | |
void | SetBodyObjectLayer | |
void | SetBodyRotation | |
bool | GetBodyPose | Origin pose of a body; false for an invalid or removed one. |
bool | SaveState | 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. |
bool | RestoreState | |
uint64_t | ComputeStateChecksum | Hash of SaveState: two worlds fed the same inputs agree on it exactly when they simulated identically (meaningful under p.Deterministic). |
bool | GetBodyState | Partial snapshots for the bodies one peer owns. |
bool | ApplyBodyState | |
void | CaptureBodyStates | |
uint32_t | ApplyBodyStates | Applies each state to the binding with the same key; returns how many matched. |
void | TeleportBody | Moves a body without waking it or touching its velocity. |
Vec3 | GetBodyCenterOfMass | |
void | SetMotionType | |
EPhysicsMotionType | GetMotionType | Static for an invalid body. |
bool | HasContactSensorRecord | 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. |
const PhysicsConfig& | GetConfig | |
PhysicsDebugSettings& | GetDebugSettings | GetDebugSettings() returns a writable reference so the editor can flip checkboxes without going through setters. |
const PhysicsDebugSettings& | GetDebugSettings | |
const PhysicsStats& | GetStats | Snapshot of body / constraint counts + step timing. |
void | RefreshStats | |
void | DrawDebug | Walks every body via the locking interface and submits lines to the engine's DebugDraw. |
Function details
PhysicsWorld
PhysicsWorld()~PhysicsWorld
~PhysicsWorld()PhysicsWorld
PhysicsWorld(const PhysicsWorld&) = deleteoperator=
PhysicsWorld& operator=(const PhysicsWorld&) = deleteInitialize
void Initialize(const PhysicsConfig& config = PhysicsConfig())Shutdown
void Shutdown()Step
void Step(float deltaTime)StepAsync
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
void WaitForStep() constIsStepInFlight
bool IsStepInFlight() constGetLastAsyncStepMs
float GetLastAsyncStepMs() constGetAsyncJoinStalls
uint64_t GetAsyncJoinStalls() constGetImpl
FPhysicsWorldImpl& GetImpl() constPhysics-internal: the Jolt side of this world, joined first like every other entry point. The type is only complete inside the Physics module.
AddForce
void AddForce(FPhysicsBodyId bodyID, Vec3 force)Force / Impulse / Torque (operate on dynamic bodies)
AddImpulse
void AddImpulse(FPhysicsBodyId bodyID, Vec3 impulse)AddTorque
void AddTorque(FPhysicsBodyId bodyID, Vec3 torque)AddForceAtPosition
void AddForceAtPosition(FPhysicsBodyId bodyID, Vec3 force, Vec3 position)AddImpulseAtPosition
void AddImpulseAtPosition(FPhysicsBodyId bodyID, Vec3 impulse, Vec3 position)SetPersistentForce
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
void SetPersistentTorque(FPhysicsBodyId bodyID, Vec3 torque)AddPersistentForce
void AddPersistentForce(FPhysicsBodyId bodyID, Vec3 force)AddPersistentForceAtPosition
void AddPersistentForceAtPosition(FPhysicsBodyId bodyID, Vec3 force, Vec3 position)AddPersistentTorque
void AddPersistentTorque(FPhysicsBodyId bodyID, Vec3 torque)ClearPersistentForce
void ClearPersistentForce(FPhysicsBodyId bodyID)ClearPersistentForces
void ClearPersistentForces()SetLinearVelocity
void SetLinearVelocity(FPhysicsBodyId bodyID, Vec3 velocity)SetAngularVelocity
void SetAngularVelocity(FPhysicsBodyId bodyID, Vec3 velocity)GetLinearVelocity
Vec3 GetLinearVelocity(FPhysicsBodyId bodyID) constGetAngularVelocity
Vec3 GetAngularVelocity(FPhysicsBodyId bodyID) constSetBodyFriction
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
void SetBodyRestitution(FPhysicsBodyId bodyID, float restitution)GetBodyFriction
float GetBodyFriction(FPhysicsBodyId bodyID) constGetBodyRestitution
float GetBodyRestitution(FPhysicsBodyId bodyID) constRaycast
bool Raycast(Vec3 origin, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constQueries. ignoreBody drops one body from the result set — pass the querying entity's own body so a character does not detect itself.
RaycastAll
bool RaycastAll(Vec3 origin, Vec3 dir, float maxDist, std::vector<RaycastHit>& hits, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constSphereCast
bool SphereCast(Vec3 origin, float radius, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constBoxCast
bool BoxCast(Vec3 center, Vec3 halfExtents, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constCapsuleCast
bool CapsuleCast(Vec3 origin, float radius, float halfHeight, Vec3 dir, float maxDist, RaycastHit& hit, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constRaycastChannel
bool RaycastChannel(Vec3 origin, Vec3 dir, float maxDist, ECollisionChannel traceChannel, RaycastHit& hit, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constTrace-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
std::vector<FPhysicsBodyId> OverlapSphere(Vec3 center, float radius, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constOverlap 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
std::vector<FPhysicsBodyId> OverlapBox(Vec3 center, Vec3 halfExtents, uint32_t layerMask = 0xFFFFFFFF, FPhysicsBodyId ignoreBody = FPhysicsBodyId()) constQueryRay
bool QueryRay(Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, FQueryHit& hit) constThe 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
bool QueryRayMulti(Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, std::vector<FQueryHit>& hits) constQuerySweep
bool QuerySweep(EQueryShape shape, Vec3 extents, Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, FQueryHit& hit) constQuerySweepMulti
bool QuerySweepMulti(EQueryShape shape, Vec3 extents, Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter, std::vector<FQueryHit>& hits) constQueryOverlap
bool QueryOverlap(EQueryShape shape, Vec3 extents, Vec3 center, const FQueryFilter& filter, std::vector<FQueryHit>& hits) constQueryRayAny
bool QueryRayAny(Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter) constExistence 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
bool QuerySweepAny(EQueryShape shape, Vec3 extents, Vec3 origin, Vec3 direction, float maxDistance, const FQueryFilter& filter) constQueryOverlapAny
bool QueryOverlapAny(EQueryShape shape, Vec3 extents, Vec3 center, const FQueryFilter& filter) constQueryPoint
bool QueryPoint(Vec3 point, const FQueryFilter& filter, std::vector<FQueryHit>& hits) constEvery body whose shape contains the point. Hits are unordered; the location is the point itself and the normal is zero.
ExecuteRayBatch
uint32_t ExecuteRayBatch(const FTraceBatchItem* items, size_t count, const FQueryFilter& filter, FQueryHit* outHits, uint8_t* outHasHit) constThe 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
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
void ClearBodyEntity(uint32_t bodyIndex)GetBodyEntity
uint64_t GetBodyEntity(uint32_t bodyIndex) constGetSurfaceAt
ESurfaceType GetSurfaceAt(FPhysicsBodyId bodyID, const FPhysicsSubShapeId& subShapeID) constSurface 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
ESurfaceType GetSurface(FPhysicsBodyId bodyID) constIsBodySleeping
bool IsBodySleeping(FPhysicsBodyId bodyID) constWakeUpBody
void WakeUpBody(FPhysicsBodyId bodyID)PutBodyToSleep
void PutBodyToSleep(FPhysicsBodyId bodyID)IsBodyAdded
bool IsBodyAdded(FPhysicsBodyId bodyID) constWhether the body is in the simulation right now (a disabled RigidBody's body exists but is removed).
CreateBody
FPhysicsBodyId CreateBody(const FPhysicsBodyDesc& desc)A body owned by the caller rather than by a component; the caller destroys it with DestroyBody.
CreateStaticMeshBody
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
void DestroyBody(FPhysicsBodyId bodyID)CreateBodyFromShape
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
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
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
std::vector<FPhysicsBodyId> CreateVoxelChunkBodies(const std::vector<FVoxelColliderDesc>& descs, uint32_t optimizeThreshold = 64)The batched form, one id per chunk.
UpdateVoxelChunk
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
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
void SetGravity(Vec3 gravity)GetGravity
Vec3 GetGravity() constGetVelocitySteps
uint32_t GetVelocitySteps() constWhat the solver actually runs with, read back from Jolt.
GetPositionSteps
uint32_t GetPositionSteps() constCreateKinematicAnchorBody
FPhysicsBodyId CreateKinematicAnchorBody(Vec3 position, uint8_t layer)DestroyAnchorBody
void DestroyAnchorBody(FPhysicsBodyId bodyID)MoveKinematicBody
void MoveKinematicBody(FPhysicsBodyId bodyID, Vec3 position, float deltaTime)CreatePositionMotorConstraint
FPhysicsConstraintHandle CreatePositionMotorConstraint(FPhysicsBodyId anchorBody, FPhysicsBodyId carriedBody, Vec3 holdPoint, float frequency, float damping, float maxForce)RemoveHoldConstraint
void RemoveHoldConstraint(FPhysicsConstraintHandle constraint)CreateHingeConstraint
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
FPhysicsConstraintHandle CreateSliderConstraint(FPhysicsBodyId bodyID, FPhysicsBodyId otherBody, Vec3 worldPoint, Vec3 worldAxis, float limitMin, float limitMax)RemoveConstraint
void RemoveConstraint(FPhysicsConstraintHandle constraint)GetHingeAngle
float GetHingeAngle(FPhysicsConstraintHandle constraint) constSetHingeMotorTarget
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
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
void SetHingeMotorOff(FPhysicsConstraintHandle constraint)SetSixDofMotorSprings
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
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
float GetSliderPosition(FPhysicsConstraintHandle constraint) constSetBodyObjectLayer
void SetBodyObjectLayer(FPhysicsBodyId bodyID, uint8_t layer)SetBodyRotation
void SetBodyRotation(FPhysicsBodyId bodyID, const Quat& rotation)GetBodyPose
bool GetBodyPose(FPhysicsBodyId bodyID, Vec3& outPosition, Quat& outRotation) constOrigin pose of a body; false for an invalid or removed one.
SaveState
bool SaveState(std::vector<uint8_t>& outState) constThe 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
bool RestoreState(const std::vector<uint8_t>& state)ComputeStateChecksum
uint64_t ComputeStateChecksum() constHash 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
bool GetBodyState(FPhysicsBodyId bodyID, uint32_t key, FPhysicsBodyState& outState) constPartial 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
bool ApplyBodyState(FPhysicsBodyId bodyID, const FPhysicsBodyState& state)CaptureBodyStates
void CaptureBodyStates(const std::vector<FPhysicsBodyBinding>& bindings, std::vector<FPhysicsBodyState>& outStates) constApplyBodyStates
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
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
Vec3 GetBodyCenterOfMass(FPhysicsBodyId bodyID) constSetMotionType
void SetMotionType(FPhysicsBodyId bodyID, EPhysicsMotionType motionType)GetMotionType
EPhysicsMotionType GetMotionType(FPhysicsBodyId bodyID) constStatic for an invalid body.
HasContactSensorRecord
bool HasContactSensorRecord(uint32_t bodyIndex) constWhether 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
const PhysicsConfig& GetConfig() constGetDebugSettings
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
const PhysicsDebugSettings& GetDebugSettings() constGetStats
const PhysicsStats& GetStats() constSnapshot 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
void RefreshStats(float lastStepTimeMs)DrawDebug
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.