Package com.jme3.bullet.util
Class DebugShapeFactory
java.lang.Object
com.jme3.bullet.util.DebugShapeFactory
A utility class to generate debug meshes for Bullet collision shapes.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
specify high-resolution debug meshes for convex shapes (up to 256 vertices) and zero-margin debug meshes for concave shapesstatic final int
specify high-resolution debug meshes for convex shapes (up to 256 vertices) and actual-margin debug meshes for concave shapesstatic final Logger
message logger for this classstatic final int
specify low-res debug meshes for convex shapes (up to 42 vertices) and zero-margin debug meshes for concave shapes -
Method Summary
Modifier and TypeMethodDescriptionstatic FloatBuffer
debugVertices
(CollisionShape shape, int meshResolution) Determine vertex locations for the specified collision shape.static FloatBuffer
getDebugTriangles
(CollisionShape shape, int meshResolution) Generate vertex locations for triangles to visualize the specified collision shape.static float
maxDistance
(CollisionShape shape, Transform shapeToWorld, int meshResolution) Estimate how far the specified (non-compound, non-plane) shape extends from some origin, based on its debug mesh.static float
volumeConvex
(ConvexShape shape, int meshResolution) Calculate the volume of a debug mesh for the specified convex shape.
-
Field Details
-
highResolution
public static final int highResolutionspecify high-resolution debug meshes for convex shapes (up to 256 vertices) and zero-margin debug meshes for concave shapes- See Also:
-
highResolution2
public static final int highResolution2specify high-resolution debug meshes for convex shapes (up to 256 vertices) and actual-margin debug meshes for concave shapes- See Also:
-
lowResolution
public static final int lowResolutionspecify low-res debug meshes for convex shapes (up to 42 vertices) and zero-margin debug meshes for concave shapes- See Also:
-
logger
message logger for this class
-
-
Method Details
-
debugVertices
Determine vertex locations for the specified collision shape. Note: recursive!- Parameters:
shape
- the input shape (not null, unaffected)meshResolution
- 0→low, 1→high for convex shapes, 2→high for all shapes- Returns:
- a new, unflipped, direct buffer full of scaled shape coordinates (capacity a multiple of 3)
-
getDebugTriangles
Generate vertex locations for triangles to visualize the specified collision shape. Note: recursive!- Parameters:
shape
- the shape to visualize (not null, unaffected)meshResolution
- 0→low, 1→high for convex shapes, 2→high for all shapes- Returns:
- a new, unflipped, direct buffer full of scaled shape coordinates (capacity a multiple of 9)
-
maxDistance
Estimate how far the specified (non-compound, non-plane) shape extends from some origin, based on its debug mesh. The shape's scale and margin are taken into account, but not its debug-mesh resolution.- Parameters:
shape
- (not null, not compound, not plane, unaffected)shapeToWorld
- the transform to apply to debug-mesh coordinates (not null, unaffected)meshResolution
- 0→low, 1→high for convex shapes, 2→high for all shapes- Returns:
- the maximum length of the transformed vertex locations (≥0)
-
volumeConvex
Calculate the volume of a debug mesh for the specified convex shape. The shape's scale and margin are taken into account, but not its debug-mesh resolution.- Parameters:
shape
- the convex shape to analyze (not null, unaffected)meshResolution
- 0→low, 1→high for convex shapes, 2→high for all shapes- Returns:
- the scaled volume (in physics-space units cubed, ≥0)
-