Class DebugShapeFactory

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

public final class DebugShapeFactory extends Object
A utility class to generate debug meshes for Bullet collision shapes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    specify high-resolution debug meshes for convex shapes (up to 256 vertices) and zero-margin debug meshes for concave shapes
    static final int
    specify high-resolution debug meshes for convex shapes (up to 256 vertices) and actual-margin debug meshes for concave shapes
    static final Logger
    message logger for this class
    static 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 Type
    Method
    Description
    debugVertices(CollisionShape shape, int meshResolution)
    Determine vertex locations for the specified collision shape.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • highResolution

      public static final int highResolution
      specify 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 highResolution2
      specify 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 lowResolution
      specify low-res debug meshes for convex shapes (up to 42 vertices) and zero-margin debug meshes for concave shapes
      See Also:
    • logger

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

    • debugVertices

      public static FloatBuffer debugVertices(CollisionShape shape, int meshResolution)
      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

      public static FloatBuffer getDebugTriangles(CollisionShape shape, int meshResolution)
      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

      public 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. 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

      public static float volumeConvex(ConvexShape shape, int meshResolution)
      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)