Class ConvexHullShape

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

public class ConvexHullShape extends ConvexShape
A Shape to represent a convex hull defined by a collection of vertices.
  • Method Details

    • drawShrunkShape

      public void drawShrunkShape(DebugRenderer renderer, RMat44Arg comTransform, Vec3Arg scale)
      Draw how vertices are moved when the shape is shrunk by the convex radius. The shape is unaffected.
      Parameters:
      renderer - the renderer to use (not null)
      comTransform - the center-of-mass transform (not null, unaffected)
      scale - the scaling to apply (not null, unaffected)
    • getConvexRadius

      public float getConvexRadius()
      Return the convex radius. The shape is unaffected.
      Returns:
      the radius (≥0)
    • getFaceVertices

      public int getFaceVertices(int faceIndex, int[] storeIndices)
      Enumerate all vertices in the specified face. The shape is unaffected.
      Parameters:
      faceIndex - the index of the face to query (≥0, <numFaces)
      storeIndices - storage for the result (not null, modified)
      Returns:
      the number of vertices in the face
    • getFaceVertices

      public int getFaceVertices(int faceIndex, int maxVertices, int[] storeIndices)
      Enumerate all vertices in the specified face. The shape is unaffected.
      Parameters:
      faceIndex - the index of the face to query (≥0, <numFaces)
      maxVertices - the maximum number of vertices to return (≥0, default=storeIndices.length)
      storeIndices - storage for the result (not null, length≥maxVertices, modified)
      Returns:
      the number of vertices in the face (≥0)
    • getNumFaces

      public int getNumFaces()
      Count the faces in the convex hull. The shape is unaffected.
      Returns:
      the count (≥0)
    • getNumPoints

      public int getNumPoints()
      Count the vertices of the convex hull. The shape is unaffected.
      Returns:
      the count (≥0)
    • getNumVerticesInFace

      public int getNumVerticesInFace(int faceIndex)
      Count the vertices in the specified face. The shape is unaffected.
      Parameters:
      faceIndex - the index of the face to query (≥0, <numFaces)
      Returns:
      the count (≥0)
    • getPlanes

      public Plane[] getPlanes()
      Enumerate all planes of the faces. The shape is unaffected.
      Returns:
      a new array of new objects
    • getPoint

      public Vec3 getPoint(int pointIndex)
      Locate the specified vertex of the convex hull relative to its center of mass. The shape is unaffected.
      Parameters:
      pointIndex - the index of the point to locate (≥0, <numPoints)
      Returns:
      a new location vector