All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>
Direct Known Subclasses:
BroadPhaseBruteForce, BroadPhaseQuadTree

public abstract class BroadPhase extends BroadPhaseQuery
Coarse collision-detection phase to quickly eliminate body pairs that cannot collide.
  • Method Details

    • addBodiesAbort

      public void addBodiesAbort(BodyIdArray bodyIds, int numBodies, long addState)
      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 by addBodiesPrepare()
    • addBodiesFinalize

      public void addBodiesFinalize(BodyIdArray bodyIds, int numBodies, long addState)
      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 by addBodiesPrepare()
    • addBodiesPrepare

      public long addBodiesPrepare(BodyIdArray bodyIds, int numBodies)
      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() or addBodiesAbort()
    • init

      public void init(BodyManager manager, ConstBroadPhaseLayerInterface map)
      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

      public void notifyBodiesAabbChanged(BodyIdArray bodyIds, int numBodies)
      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

      public void notifyBodiesAabbChanged(BodyIdArray bodyIds, int numBodies, boolean takeLock)
      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

      public void removeBodies(BodyIdArray bodyIds, int numBodies)
      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)