Class CollisionShape

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

public abstract class CollisionShape extends Object implements com.jme3.export.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)
Author:
normenhansen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.bulletphysics.collision.shapes.CollisionShape
     
    protected float
    copy of collision margin (in physics-space units, >0, default=0)
    protected com.jme3.math.Vector3f
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    calculateLocalInertia(float mass, javax.vecmath.Vector3f vector)
    used internally, not safe
    com.bulletphysics.collision.shapes.CollisionShape
    used internally
    static float
    Read the default margin for new shapes.
    float
     
    com.jme3.math.Vector3f
     
    void
    read(com.jme3.export.JmeImporter im)
     
    void
    setCShape(com.bulletphysics.collision.shapes.CollisionShape cShape)
    used internally
    static void
    setDefaultMargin(float margin)
    Alter the default margin for new shapes.
    void
    setMargin(float margin)
     
    void
    setScale(com.jme3.math.Vector3f scale)
     
    void
    write(com.jme3.export.JmeExporter ex)
     

    Methods inherited from class java.lang.Object

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

    • cShape

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

      protected com.jme3.math.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(com.jme3.math.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 com.jme3.math.Vector3f getScale()
    • write

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

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