Package com.jme3.bullet.util
Class CollisionShapeFactory
java.lang.Object
com.jme3.bullet.util.CollisionShapeFactory
Utility methods for generating collision shapes from models.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.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.static GImpactCollisionShape
createGImpactShape
(com.jme3.scene.Spatial modelRoot) Create a mesh-accurate shape for a movable object, based on its model.static CollisionShape
createMergedBoxShape
(com.jme3.scene.Spatial modelRoot) Create a very simple shape for an object, based its model's bounding box.static HullCollisionShape
createMergedHullShape
(com.jme3.scene.Spatial modelRoot) Create a simplified shape for a movable object, based the convex hull of its model.static MeshCollisionShape
createMergedMeshShape
(com.jme3.scene.Spatial modelRoot) Create a mesh-accurate shape for an immovable object, based on its model.static CollisionShape
createMeshShape
(com.jme3.scene.Spatial modelRoot) Create a mesh-accurate shape for an immovable object, based on its model.static CompoundCollisionShape
createVhacdShape
(com.jme3.scene.Spatial modelRoot, VHACDParameters parameters, CompoundCollisionShape addResult) Create a shape for a dynamic object using classic V-HACD.static CompoundCollisionShape
createVhacdShape
(com.jme3.scene.Spatial modelRoot, Vhacd4Parameters parameters, CompoundCollisionShape addResult) Create a shape for a dynamic object using V-HACD version 4.
-
Field Details
-
logger
message logger for this class
-
-
Method Details
-
createBoxShape
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
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
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
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
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
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
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)
-