Class CollisionShape

java.lang.Object
com.jme3.bullet.collision.shapes.CollisionShape
All Implemented Interfaces:
Savable
Direct Known Subclasses:
BoxCollisionShape, CapsuleCollisionShape, CompoundCollisionShape, ConeCollisionShape, CylinderCollisionShape, GImpactCollisionShape, HeightfieldCollisionShape, HullCollisionShape, MeshCollisionShape, PlaneCollisionShape, SimplexCollisionShape, SphereCollisionShape

public abstract class CollisionShape extends Object implements Savable
This Object holds information about a jbullet CollisionShape to be able to reuse CollisionShapes (as suggested in bullet manuals) TODO: add static methods to create shapes from nodes (like jbullet-jme constructor)
  • Field Details

    • cShape

      protected com.bulletphysics.collision.shapes.CollisionShape cShape
    • scale

      protected Vector3f scale
    • margin

      protected float margin
      copy of collision margin (in physics-space units, >0, default=0)
  • Constructor Details

    • CollisionShape

      protected CollisionShape()
  • Method Details

    • calculateLocalInertia

      public void calculateLocalInertia(float mass, javax.vecmath.Vector3f vector)
      used internally, not safe
      Parameters:
      mass - the desired mass for the body
      vector - storage for the result (not null, modified)
    • getCShape

      public com.bulletphysics.collision.shapes.CollisionShape getCShape()
      used internally
      Returns:
      the pre-existing instance
    • setCShape

      public void setCShape(com.bulletphysics.collision.shapes.CollisionShape cShape)
      used internally
      Parameters:
      cShape - the shape to use (alias created)
    • setScale

      public void setScale(Vector3f scale)
    • getMargin

      public float getMargin()
    • setDefaultMargin

      public static void setDefaultMargin(float margin)
      Alter the default margin for new shapes.
      Parameters:
      margin - the desired margin distance (in physics-space units, >0, default=0.04)
    • getDefaultMargin

      public static float getDefaultMargin()
      Read the default margin for new shapes.
      Returns:
      margin the default margin distance (in physics-space units, >0)
    • setMargin

      public void setMargin(float margin)
    • getScale

      public Vector3f getScale()
    • write

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException