Class BodyId

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

public class BodyId extends JoltPhysicsObject implements ConstBodyId
Identify a particular Body to a BodyInterface. (native type: BodyID)
  • Constructor Details

    • BodyId

      public BodyId()
      Instantiate a default ID.
    • BodyId

      public BodyId(long idVa)
      Instantiate with the specified native object assigned but not owned.

      For use in custom collectors and custom listeners.

      Parameters:
      idVa - the virtual address of the native object to assign (not zero)
  • Method Details

    • setIndexAndSequenceNumber

      public void setIndexAndSequenceNumber(int value)
      Alter the index and sequence number.
      Parameters:
      value - the desired value
    • copy

      public BodyId copy()
      Create a mutable copy. The current ID is unaffected.
      Specified by:
      copy in interface ConstBodyId
      Returns:
      a new mutable JVM object with a new native object assigned
    • getIndex

      public int getIndex()
      Return the body's index in the array. The ID is unaffected.
      Specified by:
      getIndex in interface ConstBodyId
      Returns:
      the index (≥0)
    • getIndexAndSequenceNumber

      public int getIndexAndSequenceNumber()
      Convert the ID to an integer. The ID is unaffected.
      Specified by:
      getIndexAndSequenceNumber in interface ConstBodyId
      Returns:
      the integer value
    • getSequenceNumber

      public int getSequenceNumber()
      Return the body's sequence number. The ID is unaffected.
      Specified by:
      getSequenceNumber in interface ConstBodyId
      Returns:
      the sequence number (≥0)
    • isEqual

      public boolean isEqual(ConstBodyId id2)
      Test whether the current ID is equal to the argument. The current ID is unaffected.
      Specified by:
      isEqual in interface ConstBodyId
      Parameters:
      id2 - the 2nd ID to test (not null, unaffected)
      Returns:
      true if equal, false if unequal
    • isInvalid

      public boolean isInvalid()
      Test whether the ID is valid. It is unaffected.
      Specified by:
      isInvalid in interface ConstBodyId
      Returns:
      true if invalid, false if valid