Class CollisionShapeFactory

java.lang.Object
com.jme3.bullet.util.CollisionShapeFactory

public final class CollisionShapeFactory extends Object
Utility methods for generating collision shapes from models.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Method Details

    • createBoxShape

      public static CollisionShape createBoxShape(com.jme3.scene.Spatial modelRoot)
      Create a simplified shape for a movable object, based on the axis-aligned bounding boxes of its meshes.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a CompoundCollisionShape with box shapes as children
    • createDynamicMeshShape

      public static CollisionShape createDynamicMeshShape(com.jme3.scene.Spatial modelRoot)
      Create a shape for a movable object, based on the convex hulls of its model's meshes.

      For mesh-accurate movable objects (CPU-intense!) use GImpactCollisionShape.

      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a new HullCollisionShape (if modelRoot is a Geometry) or a new CompoundCollisionShape with hull shapes as children (if modelRoot is a Node)
    • createGImpactShape

      public static GImpactCollisionShape createGImpactShape(com.jme3.scene.Spatial modelRoot)
      Create a mesh-accurate shape for a movable object, based on its model. Terrain is ignored.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a new GImpactCollisionShape
    • createMergedBoxShape

      public static CollisionShape createMergedBoxShape(com.jme3.scene.Spatial modelRoot)
      Create a very simple shape for an object, based its model's bounding box.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a new CompoundCollisionShape
    • createMergedHullShape

      public static HullCollisionShape createMergedHullShape(com.jme3.scene.Spatial modelRoot)
      Create a simplified shape for a movable object, based the convex hull of its model.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a new HullCollisionShape
    • createMergedMeshShape

      public static MeshCollisionShape createMergedMeshShape(com.jme3.scene.Spatial modelRoot)
      Create a mesh-accurate shape for an immovable object, based on its model. This version ignores terrain.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a new MeshCollisionShape
    • createMeshShape

      public static CollisionShape createMeshShape(com.jme3.scene.Spatial modelRoot)
      Create a mesh-accurate shape for an immovable object, based on its model. This version handles terrain.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      Returns:
      a new MeshCollisionShape (if modelRoot is a Geometry) or a new HeightfieldCollisionShape (if modelRoot is a TerrainQuad or TerrainPatch) or a new CompoundCollisionShape with mesh/heightfield shapes as children (if modelRoot is a Node)
    • createVhacdShape

      public static CompoundCollisionShape createVhacdShape(com.jme3.scene.Spatial modelRoot, VHACDParameters parameters, CompoundCollisionShape addResult)
      Create a shape for a dynamic object using classic V-HACD.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      parameters - (not null, unaffected)
      addResult - the compound shape to append to (modified if not null)
      Returns:
      a compound shape (either addResult or a new shape, not null)
    • createVhacdShape

      public static CompoundCollisionShape createVhacdShape(com.jme3.scene.Spatial modelRoot, Vhacd4Parameters parameters, CompoundCollisionShape addResult)
      Create a shape for a dynamic object using V-HACD version 4.
      Parameters:
      modelRoot - the model on which to base the shape (not null, unaffected)
      parameters - (not null, unaffected)
      addResult - the compound shape to append to (modified if not null)
      Returns:
      a compound shape (either addResult or a new shape, not null)