Class HeightfieldCollisionShape

java.lang.Object
com.jme3.bullet.collision.shapes.CollisionShape
com.jme3.bullet.collision.shapes.HeightfieldCollisionShape
All Implemented Interfaces:
com.jme3.export.Savable

public class HeightfieldCollisionShape extends CollisionShape
Uses Bullet Physics Heightfield terrain collision system. This is MUCH faster than using a regular mesh. There are a couple tricks though: -No rotation or translation is supported. -The collision bbox must be centered around 0,0,0 with the height above and below the y-axis being equal on either side. If not, the whole collision box is shifted vertically and things don't collide as they should.
Author:
Brent Owens
  • Field Details

    • heightStickWidth

      protected int heightStickWidth
    • heightStickLength

      protected int heightStickLength
    • heightfieldData

      protected float[] heightfieldData
    • heightScale

      protected float heightScale
    • minHeight

      protected float minHeight
    • maxHeight

      protected float maxHeight
    • upAxis

      protected int upAxis
    • flipQuadEdges

      protected boolean flipQuadEdges
  • Constructor Details

    • HeightfieldCollisionShape

      protected HeightfieldCollisionShape()
    • HeightfieldCollisionShape

      public HeightfieldCollisionShape(float[] heightmap)
    • HeightfieldCollisionShape

      public HeightfieldCollisionShape(float[] heightmap, com.jme3.math.Vector3f scale)
  • Method Details

    • createCollisionHeightfield

      protected void createCollisionHeightfield(float[] heightmap, com.jme3.math.Vector3f worldScale)
    • createShape

      protected void createShape()
    • createJmeMesh

      public com.jme3.scene.Mesh createJmeMesh()
    • write

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

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