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

public class BoxShape extends ConvexShape
A Shape to represent centered, axis-aligned rectangular solids.
  • Constructor Details

    • BoxShape

      public BoxShape(float halfExtent)
      Instantiate a cubic shape with the specified half extents.
      Parameters:
      halfExtent - the desired half extents (≥0.05)
    • BoxShape

      public BoxShape(float xHalfExtent, float yHalfExtent, float zHalfExtent)
      Instantiate a shape with the specified half extents.
      Parameters:
      xHalfExtent - the desired half extents on the local X axis (≥0.05)
      yHalfExtent - the desired half extents on the local Y axis (≥0.05)
      zHalfExtent - the desired half extents on the local Z axis (≥0.05)
    • BoxShape

      public BoxShape(Vec3Arg halfExtents)
      Instantiate a shape with the specified half extents.
      Parameters:
      halfExtents - the desired half extents on each local axis (not null, all components ≥0.05, unaffected)
    • BoxShape

      public BoxShape(Vec3Arg halfExtents, float convexRadius)
      Instantiate a shape with the specified half extents and convex radius.
      Parameters:
      halfExtents - the desired half extents on each local axis (not null, all components ≥convexRadius, unaffected)
      convexRadius - the desired convex radius (default=0.05)
    • BoxShape

      public BoxShape(Vec3Arg halfExtents, float convexRadius, ConstPhysicsMaterial material)
      Instantiate a shape with the specified parameters.
      Parameters:
      halfExtents - the desired half extents on each local axis (not null, all components ≥convexRadius, unaffected)
      convexRadius - the desired convex radius (default=0.05)
      material - the desired material (default=null)
  • Method Details

    • getConvexRadius

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

      public Vec3 getHalfExtent()
      Copy the half extents. The shape is unaffected.
      Returns:
      a new vector