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

public class BodyVector extends Array<Body>
A variable-length vector (array) of bodies. (native type: Array<Body *>)
  • Method Details

    • getManager

      public BodyManager getManager()
      Access the underlying BodyManager.
      Returns:
      the pre-existing instance (not null)
    • capacity

      public int capacity()
      Count how many bodies the currently allocated storage can hold. The vector is unaffected.
      Specified by:
      capacity in class Array<Body>
      Returns:
      the number of bodies (≥size)
    • erase

      public void erase(int startIndex, int stopIndex)
      Remove all bodies in the specified range of indices.
      Specified by:
      erase in class Array<Body>
      Parameters:
      startIndex - the index of the first element to remove (≥0)
      stopIndex - one plus the index of the last element to remove (≥0)
    • get

      public Body get(int elementIndex)
      Access the body at the specified index.
      Specified by:
      get in class Array<Body>
      Parameters:
      elementIndex - the index from which to get the body (≥0)
      Returns:
      a new JVM object with the pre-existing native object assigned, or else null
    • resize

      public void resize(int numBodies)
      Expand or truncate the vector.
      Specified by:
      resize in class Array<Body>
      Parameters:
      numBodies - the desired size (number of bodies, ≥0)
    • set

      public void set(int elementIndex, Body body)
      Put the specified body at the specified index.
      Specified by:
      set in class Array<Body>
      Parameters:
      elementIndex - the index at which to put the body (≥0)
      body - the body to put (not null)
    • size

      public int size()
      Count how many bodies are in the vector. The vector is unaffected.
      Specified by:
      size in class Array<Body>
      Returns:
      the number of bodies (≥0, ≤capacity)