Jolt Physics
A multi core friendly Game Physics Engine
|
Used to do coarse collision detection operations to quickly prune out bodies that will not collide. More...
#include <BroadPhase.h>
Classes | |
struct | UpdateState |
Context used during broadphase update. More... | |
Public Types | |
using | AddState = void * |
Handle used during adding bodies to the broadphase. | |
Protected Attributes | |
BodyManager * | mBodyManager = nullptr |
Link to the body manager that manages the bodies in this broadphase. | |
Used to do coarse collision detection operations to quickly prune out bodies that will not collide.
Handle used during adding bodies to the broadphase.
|
inlinevirtual |
Abort adding bodies to the broadphase, supply the return value of AddBodiesPrepare in inAddState. This can be done on a background thread without influencing the broadphase. Please ensure that the ioBodies array passed to AddBodiesPrepare is unmodified and passed again to this function.
Reimplemented in BroadPhaseQuadTree.
|
pure virtual |
Finalize adding bodies to the broadphase, supply the return value of AddBodiesPrepare in inAddState. Please ensure that the ioBodies array passed to AddBodiesPrepare is unmodified and passed again to this function.
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
Prepare adding inNumber bodies at ioBodies to the broadphase, returns a handle that should be used in AddBodiesFinalize/Abort. This can be done on a background thread without influencing the broadphase. ioBodies may be shuffled around by this function and should be kept that way until AddBodiesFinalize/Abort is called.
Reimplemented in BroadPhaseQuadTree.
|
pure virtual |
Same as BroadPhaseQuery::CastAABox but can be implemented in a way to take no broad phase locks.
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
|
pure virtual |
Find all colliding pairs between dynamic bodies Note that this function is very specifically tailored for the PhysicsSystem::Update function, hence it is not part of the BroadPhaseQuery interface. One of the assumptions it can make is that no locking is needed during the query as it will only be called during a very particular part of the update.
ioActiveBodies | is a list of bodies for which we need to find colliding pairs (this function can change the order of the ioActiveBodies array). This can be a subset of the set of active bodies in the system. |
inNumActiveBodies | is the size of the ioActiveBodies array. |
inSpeculativeContactDistance | Distance at which speculative contact points will be created. |
inObjectVsBroadPhaseLayerFilter | is the filter that determines if an object can collide with a broadphase layer. |
inObjectLayerPairFilter | is the filter that determines if two objects can collide. |
ioPairCollector | receives callbacks for every body pair found. |
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
Must be called just before updating the broadphase when none of the body mutexes are locked.
Reimplemented in BroadPhaseQuadTree.
Get the bounding box of all objects in the broadphase.
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
|
virtual |
Initialize the broadphase.
inBodyManager | The body manager singleton |
inLayerInterface | Interface that maps object layers to broadphase layers. Note that the broadphase takes a pointer to the data inside inObjectToBroadPhaseLayer so this object should remain static. |
Reimplemented in BroadPhaseQuadTree.
Must be called before UpdatePrepare to prevent modifications from being made to the tree.
Reimplemented in BroadPhaseQuadTree.
|
pure virtual |
Call whenever the aabb of a body changes (can change order of ioBodies array) inTakeLock should be false if we're between LockModifications/UnlockModificiations in which case care needs to be taken to not call this between UpdatePrepare/UpdateFinalize
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
Call whenever the layer (and optionally the aabb as well) of a body changes (can change order of ioBodies array)
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
Should be called after many objects have been inserted to make the broadphase more efficient, usually done on startup only.
Reimplemented in BroadPhaseQuadTree.
Remove inNumber bodies in ioBodies from the broadphase. ioBodies may be shuffled around by this function.
Implemented in BroadPhaseBruteForce, and BroadPhaseQuadTree.
Must be called after UpdateFinalize to allow modifications to the broadphase.
Reimplemented in BroadPhaseQuadTree.
|
inlinevirtual |
Finalizing the update will quickly apply the changes.
Reimplemented in BroadPhaseQuadTree.
|
inlinevirtual |
Update the broadphase, needs to be called frequently to update the internal state when bodies have been modified. The UpdatePrepare() function can run in a background thread without influencing the broadphase
Reimplemented in BroadPhaseQuadTree.
|
protected |
Link to the body manager that manages the bodies in this broadphase.