Package com.github.stephengold.joltjni
Class BroadPhase
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.BroadPhaseQuery
com.github.stephengold.joltjni.BroadPhase
- All Implemented Interfaces:
ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
- Direct Known Subclasses:
BroadPhaseBruteForce,BroadPhaseQuadTree
Coarse collision-detection phase to quickly eliminate body pairs that cannot
collide.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBodiesAbort(BodyId[] bodyIds, int numBodies, long addState) Abort adding bodies to the phase.voidaddBodiesAbort(BodyId[] bodyIds, long addState) Abort adding bodies to the phase.voidaddBodiesFinalize(BodyId[] bodyIds, int numBodies, long addState) Finish adding bodies to the phase.voidaddBodiesFinalize(BodyId[] bodyIds, long addState) Finish adding bodies to the phase.longaddBodiesPrepare(BodyId... bodyIds) Prepare to add a batch of bodies to the phase.longaddBodiesPrepare(BodyId[] bodyIds, int numBodies) Prepare for adding multiple bodies to the phase.voidinit(BodyManager manager, ConstBroadPhaseLayerInterface map) Initialize the phase.voidnotifyBodiesAabbChanged(BodyId... bodyIds) Invoke whenever the bounding boxes of some bodies change.voidnotifyBodiesAabbChanged(BodyId[] bodyIds, int numBodies) Invoke whenever the bounding boxes of some bodies change.voidnotifyBodiesAabbChanged(BodyId[] bodyIds, int numBodies, boolean takeLock) Invoke whenever the bounding boxes of some bodies change.voidoptimize()Optimize the phase after adding objects.voidremoveBodies(BodyId... bodyIds) Remove multiple bodies from the phase.voidremoveBodies(BodyId[] bodyIds, int numBodies) Remove multiple bodies from the phase.Methods inherited from class com.github.stephengold.joltjni.BroadPhaseQuery
castRay, castRay, castRay, collideAaBox, collideAaBox, collideAaBox, collidePoint, collideSphere, getSystemMethods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, va
-
Method Details
-
addBodiesAbort
Abort adding bodies to the phase.- Parameters:
bodyIds- the IDs of the bodies to be added (not null, unmodified since the handle was created)addState- the handle returned byaddBodiesPrepare()
-
addBodiesAbort
Abort adding bodies to the phase.- Parameters:
bodyIds- the IDs of the bodies to be added (not null, unmodified since the handle was created)numBodies- the number of bodies to be added (≥0)addState- the handle returned byaddBodiesPrepare()
-
addBodiesFinalize
Finish adding bodies to the phase.- Parameters:
bodyIds- the IDs of the bodies to be added (not null, unmodified since the handle was created)addState- the handle returned byaddBodiesPrepare()
-
addBodiesFinalize
Finish adding bodies to the phase.- Parameters:
bodyIds- the IDs of the bodies to be added (not null, unmodified since the handle was created)numBodies- the number of bodies to be added (≥0)addState- the handle returned byaddBodiesPrepare()
-
addBodiesPrepare
Prepare to add a batch of bodies to the phase.- Parameters:
bodyIds- the IDs of the bodies to be added (not null)- Returns:
- a handle to be passed to
addBodiesFinalize()oraddBodiesFinalize()
-
addBodiesPrepare
Prepare for adding multiple bodies to the phase.- Parameters:
bodyIds- the IDs of the bodies to be added (not null, possibly shuffled)numBodies- the number of bodies to be added (≥0)- Returns:
- a handle to be passed to
addBodiesFinalize()oraddBodiesFinalize()
-
init
Initialize the phase.- Parameters:
manager- the manager to use (not null)map- the desired map from object layers to broad-phase layers (not null, alias created)
-
optimize
public void optimize()Optimize the phase after adding objects. -
notifyBodiesAabbChanged
Invoke whenever the bounding boxes of some bodies change.- Parameters:
bodyIds- the IDs of the bodies to be notified (not null)
-
notifyBodiesAabbChanged
Invoke whenever the bounding boxes of some bodies change.- Parameters:
bodyIds- the IDs of the bodies to be notified (not null)numBodies- the number of bodies to be notified (≥0)
-
notifyBodiesAabbChanged
Invoke whenever the bounding boxes of some bodies change.- Parameters:
bodyIds- the IDs of the bodies to be notified (not null)numBodies- the number of bodies to be notified (≥0)takeLock- true to acquire a lock, otherwise false
-
removeBodies
Remove multiple bodies from the phase.- Parameters:
bodyIds- the IDs of the bodies to be removed (not null)
-
removeBodies
Remove multiple bodies from the phase.- Parameters:
bodyIds- the IDs of the bodies to be removed (not null, possibly shuffled)numBodies- the number of bodies to be removed (≥0)
-