117 void OptimizeBroadPhase();
145#ifdef JPH_DEBUG_RENDERER
216#ifdef JPH_TRACK_BROADPHASE_STATS
218 void ReportBroadphaseStats() { mBroadPhase->ReportStats(); }
232 void JobBodySetIslandIndex();
252 void ProcessBodyPair(ContactAllocator &ioContactAllocator,
const BodyPair &inBodyPair);
261 static constexpr int cDetermineActiveConstraintsBatchSize = 64;
264 static constexpr int cSetupVelocityConstraintsBatchSize = 256;
267 static constexpr int cApplyGravityBatchSize = 64;
270 static constexpr int cActiveBodiesBatchSize = 16;
273 static constexpr int cIntegrateVelocityBatchSize = 64;
276 static constexpr int cNarrowPhaseBatchSize = 16;
279 static constexpr int cNumCCDBodiesPerJob = 4;
327 Mutex mStepListenersMutex;
331 StepListeners mStepListeners;
337 float mPreviousStepDeltaTime = 0.0f;
EBodyType
Type of body.
Definition BodyType.h:11
#define JPH_EXPORT
Definition Core.h:271
unsigned int uint
Definition Core.h:481
#define JPH_NAMESPACE_END
Definition Core.h:414
std::uint32_t uint32
Definition Core.h:484
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
EPhysicsUpdateError
Enum used by PhysicsSystem to report error conditions during the PhysicsSystem::Update call....
Definition EPhysicsUpdateError.h:11
#define JPH_IF_ENABLE_ASSERTS(...)
Definition IssueReporting.h:35
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:31
uint16 ObjectLayer
Definition ObjectLayer.h:16
EStateRecorderState
A bit field that determines which aspects of the simulation to save.
Definition StateRecorder.h:21
Axis aligned box.
Definition AABox.h:16
Definition BodyActivationListener.h:14
Class function to filter out bodies for debug rendering, returns true if body should be rendered.
Definition BodyFilter.h:117
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition BodyID.h:13
Definition BodyInterface.h:35
Implementation that uses the body manager to lock the correct mutex for a body.
Definition BodyLockInterface.h:78
Implementation that performs no locking (assumes the lock has already been taken)
Definition BodyLockInterface.h:58
Class that contains all bodies.
Definition BodyManager.h:44
Used to do coarse collision detection operations to quickly prune out bodies that will not collide.
Definition BroadPhase.h:26
Interface that the application should implement to allow mapping object layers to broadphase layers.
Definition BroadPhaseLayer.h:61
Definition BroadPhaseQuery.h:29
Base class for all physics constraints. A constraint removes one or more degrees of freedom for a rig...
Definition Constraint.h:103
A constraint manager manages all constraints of the same type.
Definition ConstraintManager.h:25
Definition DebugRenderer.h:47
Default filter class that uses the pair filter in combination with a specified layer to filter layers...
Definition BroadPhaseLayer.h:108
Default filter class that uses the pair filter in combination with a specified layer to filter layers...
Definition ObjectLayer.h:64
Keeps track of connected bodies and builds islands for multithreaded velocity/position update.
Definition IslandBuilder.h:19
Definition JobSystem.h:70
Definition LargeIslandSplitter.h:25
Definition NarrowPhaseQuery.h:23
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition NonCopyable.h:11
Filter class to test if two objects can collide based on their object layer. Used while finding colli...
Definition ObjectLayer.h:50
Class to test if an object can collide with a broadphase layer. Used while finding collision pairs.
Definition BroadPhaseLayer.h:80
A listener class that receives a callback before every physics simulation step.
Definition PhysicsStepListener.h:23
Definition PhysicsSystem.h:30
void GetBodies(BodyIDVector &outBodyIDs) const
Definition PhysicsSystem.h:195
void DrawConstraintReferenceFrame(DebugRenderer *inRenderer)
Draw the constraint reference frames only (debugging purposes)
Definition PhysicsSystem.h:159
const SimShapeFilter * GetSimShapeFilter() const
Definition PhysicsSystem.h:77
void SetCombineRestitution(ContactConstraintManager::CombineFunction inCombineRestitution)
Definition PhysicsSystem.h:68
const NarrowPhaseQuery & GetNarrowPhaseQuery() const
Interface that allows fine collision queries against first the broad phase and then the narrow phase.
Definition PhysicsSystem.h:93
void RemoveConstraints(Constraint **inConstraints, int inNumber)
Batch remove constraints.
Definition PhysicsSystem.h:106
uint GetNumBodies() const
Gets the current amount of bodies that are in the body manager.
Definition PhysicsSystem.h:179
uint32 GetNumActiveBodies(EBodyType inType) const
Gets the current amount of active bodies that are in the body manager.
Definition PhysicsSystem.h:182
void SetPhysicsSettings(const PhysicsSettings &inSettings)
Control the main constants of the physics simulation.
Definition PhysicsSystem.h:80
void SetSoftBodyContactListener(SoftBodyContactListener *inListener)
Listener that is notified whenever a contact point between a soft body and another body.
Definition PhysicsSystem.h:58
const BodyInterface & GetBodyInterface() const
Access to the body interface. This interface allows to to create / remove bodies and to change their ...
Definition PhysicsSystem.h:84
const BroadPhaseQuery & GetBroadPhaseQuery() const
Access to the broadphase interface that allows coarse collision queries.
Definition PhysicsSystem.h:90
const BodyLockInterfaceLocking & GetBodyLockInterface() const
Returns a locking interface that locks the body so other threads cannot modify it.
Definition PhysicsSystem.h:170
const NarrowPhaseQuery & GetNarrowPhaseQueryNoLock() const
Version that does not lock the bodies, use with great care!
Definition PhysicsSystem.h:94
void DrawConstraints(DebugRenderer *inRenderer)
Draw the constraints only (debugging purposes)
Definition PhysicsSystem.h:153
const PhysicsSettings & GetPhysicsSettings() const
Definition PhysicsSystem.h:81
const BodyInterface & GetBodyInterfaceNoLock() const
Version that does not lock the bodies, use with great care!
Definition PhysicsSystem.h:86
BodyInterface & GetBodyInterface()
Definition PhysicsSystem.h:85
void DrawConstraintLimits(DebugRenderer *inRenderer)
Draw the constraint limits only (debugging purposes)
Definition PhysicsSystem.h:156
Constraints GetConstraints() const
Get a list of all constraints.
Definition PhysicsSystem.h:109
void AddConstraint(Constraint *inConstraint)
Add constraint to the world.
Definition PhysicsSystem.h:97
Vec3 GetGravity() const
Definition PhysicsSystem.h:164
uint GetMaxBodies() const
Get the maximum amount of bodies that this physics system supports.
Definition PhysicsSystem.h:185
void RemoveConstraint(Constraint *inConstraint)
Remove constraint from the world.
Definition PhysicsSystem.h:100
AABox GetBounds() const
Get the bounding box of all bodies in the physics system.
Definition PhysicsSystem.h:214
void DrawBodies(const BodyManager::DrawSettings &inSettings, DebugRenderer *inRenderer, const BodyDrawFilter *inBodyFilter=nullptr)
Draw the state of the bodies (debugging purposes)
Definition PhysicsSystem.h:150
BodyActivationListener * GetBodyActivationListener() const
Definition PhysicsSystem.h:50
DefaultBroadPhaseLayerFilter GetDefaultBroadPhaseLayerFilter(ObjectLayer inLayer) const
Get an broadphase layer filter that uses the default pair filter and a specified object layer to dete...
Definition PhysicsSystem.h:173
BodyInterface & GetBodyInterfaceNoLock()
Version that does not lock the bodies, use with great care!
Definition PhysicsSystem.h:87
void SetSimShapeFilter(const SimShapeFilter *inShapeFilter)
Definition PhysicsSystem.h:76
void GetActiveBodies(EBodyType inType, BodyIDVector &outBodyIDs) const
Definition PhysicsSystem.h:200
ContactConstraintManager::CombineFunction GetCombineRestitution() const
Definition PhysicsSystem.h:69
JPH_OVERRIDE_NEW_DELETE PhysicsSystem()
Constructor / Destructor.
Definition PhysicsSystem.h:35
static bool sDrawMotionQualityLinearCast
Draw debug info for objects that perform continuous collision detection through the linear cast motio...
Definition PhysicsSystem.h:147
void SetGravity(Vec3Arg inGravity)
Set gravity value.
Definition PhysicsSystem.h:163
const BodyLockInterfaceNoLock & GetBodyLockInterfaceNoLock() const
Returns a locking interface that won't actually lock the body. Use with great care!
Definition PhysicsSystem.h:167
BodyStats GetBodyStats() const
Get stats about the bodies in the body manager (slow, iterates through all bodies)
Definition PhysicsSystem.h:191
void AddConstraints(Constraint **inConstraints, int inNumber)
Batch add constraints.
Definition PhysicsSystem.h:103
bool WereBodiesInContact(const BodyID &inBody1ID, const BodyID &inBody2ID) const
Definition PhysicsSystem.h:211
DefaultObjectLayerFilter GetDefaultLayerFilter(ObjectLayer inLayer) const
Get an object layer filter that uses the default pair filter and a specified layer to determine if la...
Definition PhysicsSystem.h:176
void SetContactListener(ContactListener *inListener)
Definition PhysicsSystem.h:54
SoftBodyContactListener * GetSoftBodyContactListener() const
Definition PhysicsSystem.h:59
ContactConstraintManager::CombineFunction GetCombineFriction() const
Definition PhysicsSystem.h:64
void SetCombineFriction(ContactConstraintManager::CombineFunction inCombineFriction)
Definition PhysicsSystem.h:63
const BodyID * GetActiveBodiesUnsafe(EBodyType inType) const
Definition PhysicsSystem.h:204
void SetBodyActivationListener(BodyActivationListener *inListener)
Listener that is notified whenever a body is activated/deactivated.
Definition PhysicsSystem.h:49
ContactListener * GetContactListener() const
Definition PhysicsSystem.h:55
Information used during the Update call.
Definition PhysicsUpdateContext.h:24
Filter class used during the simulation (PhysicsSystem::Update) to filter out collisions at shape lev...
Definition SimShapeFilter.h:17
Definition SoftBodyContactListener.h:33
User callbacks that allow determining which parts of the simulation should be saved by a StateRecorde...
Definition StateRecorder.h:79
Definition StateRecorder.h:110
Definition TempAllocator.h:16
Helper struct that counts the number of bodies of each type.
Definition BodyManager.h:62
Draw settings.
Definition BodyManager.h:231
Structure that holds a body pair.
Definition BodyPair.h:14
Definition PhysicsSettings.h:28
Contains the information needed to cast a body through the scene to do continuous collision detection...
Definition PhysicsUpdateContext.h:97
Structure that contains data needed for each collision step.
Definition PhysicsUpdateContext.h:52