Class ConicalFrustum

All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class ConicalFrustum extends ConvexShape
A collision shape for a conical frustum with uniform density, based on btConvexInternalShape. By convention, the local Y axis is the height axis, with the "A" base having y<0 and the "B" base having y>0.

This is an imprecise shape; margin always expands the shape.

  • Field Details

    • logger2

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

    • ConicalFrustum

      public ConicalFrustum(float a, float b, float height)
      Instantiate a conical frustum with the specified dimensions.
      Parameters:
      a - the desired radius of the "A" base for scale=(1,1,1) (>0)
      b - the desired radius of the "B" base for scale=(1,1,1) (>0)
      height - the desired height for scale=(1,1,1) (>0)
  • Method Details

    • aRadius

      public float aRadius()
      Return the radius of the "A" base.
      Returns:
      the unscaled radius (>0)
    • bRadius

      public float bRadius()
      Return the radius of the "B" base.
      Returns:
      the unscaled radius (>0)
    • height

      public float height()
      Return the height of the frustum.
      Returns:
      the unscaled height (>0)
    • canScale

      public boolean canScale(Vector3f scale)
      Test whether the specified scale factors can be applied to the shape. For a conical frustum, scaling must preserve the circular cross section.
      Overrides:
      canScale in class CollisionShape
      Parameters:
      scale - the desired scale factor for each local axis (may be null, unaffected)
      Returns:
      true if applicable, otherwise false
    • maxRadius

      public float maxRadius()
      Calculate how far the scaled shape extends from its center of mass, including collision margin.
      Overrides:
      maxRadius in class CollisionShape
      Returns:
      the distance (in physics-space units, ≥0)
    • scaledVolume

      public float scaledVolume()
      Estimate the volume of the collision shape, including scale and margin.
      Overrides:
      scaledVolume in class ConvexShape
      Returns:
      the estimated volume (in physics-space units cubed, ≥0)