Class BodyLockWrite

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

public class BodyLockWrite extends NonCopyable
Lock a body for read-write access.
  • Constructor Details

    • BodyLockWrite

      public BodyLockWrite(BodyLockInterface bli, int bodyId)
      Acquire a lock using the specified interface and body ID.
      Parameters:
      bli - the interface to use (not null, unaffected)
      bodyId - the ID of the body to lock
  • Method Details

    • getBody

      public Body getBody()
      Access the body.
      Returns:
      a new JVM object with the pre-existing native object assigned
    • releaseLock

      public void releaseLock()
      Explicitly release the lock. Normally this is done in the destructor.
    • succeeded

      public boolean succeeded()
      Test whether the lock was successfully acquired.
      Returns:
      true if acquired, otherwise false
    • succeededAndIsInBroadPhase

      public boolean succeededAndIsInBroadPhase()
      Test whether the lock was acquired and the body is still in broadphase.
      Returns:
      true if both conditions are met, otherwise false