Class GImpactCollisionShape

All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class GImpactCollisionShape extends CollisionShape
A mesh collisions shape based on Bullet's btGImpactMeshShape.

Collisions between GImpactCollisionShape and PlaneCollisionShape objects are never detected.

  • Field Details

    • logger2

      public static final Logger logger2
      message logger for this class
  • Constructor Details

    • GImpactCollisionShape

      public GImpactCollisionShape(CompoundMesh mesh, Vector3f offset)
      Instantiate a shape based on the specified CompoundMesh and offset.
      Parameters:
      mesh - the mesh on which to base the shape (not null, unaffected)
      offset - the offset to add to the vertex positions (not null, unaffected)
    • GImpactCollisionShape

      public GImpactCollisionShape(IndexedMesh... submeshes)
      Instantiate a shape based on the specified native mesh(es).
      Parameters:
      submeshes - the mesh(es) on which to base the shape (not null)
  • Method Details

    • countMeshTriangles

      public int countMeshTriangles()
      Count how many triangles are in the mesh.
      Returns:
      the count (≥0)
    • countMeshVertices

      public int countMeshVertices()
      Count how many vertices are in the mesh.
      Returns:
      the count (≥0)
    • countSubmeshes

      public int countSubmeshes()
      Count how many submeshes are in the mesh.
      Returns:
      the count (≥0)
    • getSubmesh

      public IndexedMesh getSubmesh(int index)
      Access the specified submesh.
      Parameters:
      index - the index of the desired submesh (in the order the submeshes were added, ≥0)
      Returns:
      the pre-existing instance (not null)
    • split

      public ChildCollisionShape[] split(Triangle splittingTriangle)
      Attempt to divide this shape into 2 shapes.
      Parameters:
      splittingTriangle - to define the splitting plane (in shape coordinates, not null, unaffected)
      Returns:
      a pair of children, the first child generated by the plane's minus side and the 2nd child generated by its plus side; either child may be null, indicating an empty shape
    • canSplit

      public boolean canSplit()
      Test whether the shape can be split by an arbitrary plane.
      Overrides:
      canSplit in class CollisionShape
      Returns:
      true
    • recalculateAabb

      protected void recalculateAabb()
      Recalculate this shape's bounding box if necessary.
      Overrides:
      recalculateAabb in class CollisionShape
    • setScale

      public void setScale(Vector3f scale)
      Alter the scale factors of this shape.

      Note that if the shape is shared (between collision objects and/or compound shapes) changes can have unintended consequences.

      Overrides:
      setScale in class CollisionShape
      Parameters:
      scale - the desired scale factor for each local axis (not null, no negative component, unaffected, default=(1,1,1))