Class CustomConvexShape

All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable, 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<com.jme3.math.Vector3f> threadTmpVector
      temporary storage for one vector per thread
  • Constructor Details

    • CustomConvexShape

      protected CustomConvexShape()
      No-argument constructor needed by SavableClassUtil.
    • 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(com.jme3.math.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 com.jme3.math.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)
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned shape into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface com.jme3.util.clone.JmeCloneable
      Overrides:
      cloneFields in class CollisionShape
      Parameters:
      cloner - the Cloner that's cloning this shape (not null)
      original - the instance from which this shape was shallow-cloned (not null, unaffected)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize the shape from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class CollisionShape
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this shape to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class CollisionShape
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter