Class CustomConvexShape

All Implemented Interfaces:
Comparable<NativePhysicsObject>

public abstract class CustomConvexShape extends ConvexShape
An abstract base class for collision shapes defined in terms of their supporting vertices, based on Bullet's btConvexInternalShape.
  • Field Details

    • loggerY

      public static final Logger loggerY
      message logger for this class
    • threadTmpVector

      protected static final ThreadLocal<Vector3f> threadTmpVector
      temporary storage for one vector per thread
  • Constructor Details

    • CustomConvexShape

      protected CustomConvexShape(float xHalfExtent, float yHalfExtent, float zHalfExtent)
      Instantiate a custom collision shape with the specified extents. Subclass constructors should also invoke setScaledInertia().
      Parameters:
      xHalfExtent - the desired half extent on the local X axis, for scale=(1,1,1) and margin=0 (>0)
      yHalfExtent - the desired half extent on the local Y axis, for scale=(1,1,1) and margin=0 (>0)
      zHalfExtent - the desired half extent on the local Z axis, for scale=(1,1,1) and margin=0 (>0)
    • CustomConvexShape

      protected CustomConvexShape(Vector3f halfExtents)
      Instantiate a custom collision shape with the specified extents. Subclass constructors should also invoke setScaledInertia().
      Parameters:
      halfExtents - the desired half extents on each local axis, for scale=(1,1,1) and margin=0 (all components >0, unaffected), or null to calculate AABBs using the supporting vertices
  • Method Details

    • locateSupport

      protected abstract Vector3f locateSupport(float dirX, float dirY, float dirZ)
      Locate the shape's supporting vertex for the specified normal direction, excluding collision margin.

      This method is invoked by native code.

      Parameters:
      dirX - the X-coordinate of the direction to test (in scaled shape coordinates)
      dirY - the Y-coordinate of the direction to test (in scaled shape coordinates)
      dirZ - the Z-coordinate of the direction to test (in scaled shape coordinates)
      Returns:
      the location on the shape's surface with the specified normal (in scaled shape coordinates, must lie on or within the shape's bounding box)
    • setScaledInertia

      protected void setScaledInertia(float ix, float iy, float iz)
      Alter the scaled rotational inertia. Typically invoked during instantiation or after a change of scale.
      Parameters:
      ix - the desired X-axis rotational inertia for mass=1 (>0)
      iy - the desired Y-axis rotational inertia for mass=1 (>0)
      iz - the desired Z-axis rotational inertia for mass=1 (>0)