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<JoltPhysicsObject>
- Direct Known Subclasses:
BroadPhaseBruteForce
,BroadPhaseQuadTree
Coarse collision-detection phase to quickly eliminate body pairs that cannot
collide.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBodiesAbort
(BodyIdArray bodyIds, int numBodies, long addState) Abort adding bodies to the phase.void
addBodiesFinalize
(BodyIdArray bodyIds, int numBodies, long addState) Finish adding bodies to the phase.long
addBodiesPrepare
(BodyIdArray bodyIds, int numBodies) Prepare to add a batch of bodies to the phase.void
init
(BodyManager manager, ConstBroadPhaseLayerInterface map) Initialize the phase.void
notifyBodiesAabbChanged
(BodyIdArray bodyIds, int numBodies) Invoke whenever the bounding boxes of some bodies change.void
notifyBodiesAabbChanged
(BodyIdArray bodyIds, int numBodies, boolean takeLock) Invoke whenever the bounding boxes of some bodies change.void
optimize()
Optimize the phase after adding objects.void
removeBodies
(BodyIdArray 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, collideSphere, collideSphere, getSystem
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, 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)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)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, possibly shuffled)numBodies
- the number of bodies to be added (≥0)- Returns:
- a handle to be passed to
addBodiesFinalize()
oraddBodiesAbort()
-
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)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, otherwisefalse
-
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)
-