Package com.jme3.bullet.collision.shapes
Class HeightfieldCollisionShape
java.lang.Object
com.jme3.bullet.collision.shapes.CollisionShape
com.jme3.bullet.collision.shapes.HeightfieldCollisionShape
- All Implemented Interfaces:
Savable
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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected float[]protected floatprotected intprotected intprotected floatprotected floatprotected intFields inherited from class com.jme3.bullet.collision.shapes.CollisionShape
cShape, margin, scale -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHeightfieldCollisionShape(float[] heightmap) HeightfieldCollisionShape(float[] heightmap, Vector3f scale) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateCollisionHeightfield(float[] heightmap, Vector3f worldScale) protected voidvoidread(JmeImporter im) voidwrite(JmeExporter ex) Methods inherited from class com.jme3.bullet.collision.shapes.CollisionShape
calculateLocalInertia, getCShape, getDefaultMargin, getMargin, getScale, setCShape, setDefaultMargin, setMargin, setScale
-
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
-
-
Method Details
-
createCollisionHeightfield
-
createShape
protected void createShape() -
createJmeMesh
-
write
- Specified by:
writein interfaceSavable- Overrides:
writein classCollisionShape- Throws:
IOException
-
read
- Specified by:
readin interfaceSavable- Overrides:
readin classCollisionShape- Throws:
IOException
-