com.jme3.bullet.collision.shapes
Class HeightfieldCollisionShape

java.lang.Object
  extended by com.jme3.bullet.collision.shapes.CollisionShape
      extended by com.jme3.bullet.collision.shapes.HeightfieldCollisionShape
All Implemented Interfaces:
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.


Field Summary
protected  java.nio.ByteBuffer bbuf
           
protected  boolean flipQuadEdges
           
protected  float[] heightfieldData
           
protected  float heightScale
           
protected  int heightStickLength
           
protected  int heightStickWidth
           
protected  float maxHeight
           
protected  float minHeight
           
protected  int upAxis
           
 
Fields inherited from class com.jme3.bullet.collision.shapes.CollisionShape
margin, objectId, scale
 
Constructor Summary
HeightfieldCollisionShape()
           
HeightfieldCollisionShape(float[] heightmap)
           
HeightfieldCollisionShape(float[] heightmap, Vector3f scale)
           
 
Method Summary
protected  void createCollisionHeightfield(float[] heightmap, Vector3f worldScale)
           
 Mesh createJmeMesh()
           
protected  void createShape()
           
 void read(JmeImporter im)
           
 void write(JmeExporter ex)
           
 
Methods inherited from class com.jme3.bullet.collision.shapes.CollisionShape
finalize, getMargin, getObjectId, getScale, setMargin, setObjectId, setScale
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

bbuf

protected java.nio.ByteBuffer bbuf
Constructor Detail

HeightfieldCollisionShape

public HeightfieldCollisionShape()

HeightfieldCollisionShape

public HeightfieldCollisionShape(float[] heightmap)

HeightfieldCollisionShape

public HeightfieldCollisionShape(float[] heightmap,
                                 Vector3f scale)
Method Detail

createCollisionHeightfield

protected void createCollisionHeightfield(float[] heightmap,
                                          Vector3f worldScale)

createShape

protected void createShape()

createJmeMesh

public Mesh createJmeMesh()

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class CollisionShape
Throws:
java.io.IOException

read

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