Class BodyLockMultiRead

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class BodyLockMultiRead extends BodyLockMultiBase
Lock multiple bodies for read-only access.
  • Constructor Details

    • BodyLockMultiRead

      public BodyLockMultiRead(BodyLockInterface bli, int... bodyIds)
      Acquire body locks using the specified interface and body IDs.
      Parameters:
      bli - the interface to use (not null, unaffected)
      bodyIds - the IDs of the bodies to lock
  • Method Details

    • getBodies

      public ConstBody[] getBodies()
      Access all the bodies.
      Specified by:
      getBodies in class BodyLockMultiBase
      Returns:
      a new array
    • getBody

      public ConstBody getBody(int index)
      Access a specific body.
      Specified by:
      getBody in class BodyLockMultiBase
      Parameters:
      index - into the array of body IDs (≥0)
      Returns:
      a new JVM object with the pre-existing native object assigned, or null if not available
    • getNumBodies

      public int getNumBodies()
      Count the bodies that were locked.
      Specified by:
      getNumBodies in class BodyLockMultiBase
      Returns:
      the number of bodies (≥0)
    • releaseLocks

      public void releaseLocks()
      Release all the locks.
      Specified by:
      releaseLocks in class BodyLockMultiBase