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:
com.jme3.export.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.
- Author:
- Brent Owens
-
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, com.jme3.math.Vector3f scale) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateCollisionHeightfield(float[] heightmap, com.jme3.math.Vector3f worldScale) com.jme3.scene.Meshprotected voidvoidread(com.jme3.export.JmeImporter im) voidwrite(com.jme3.export.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
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
- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classCollisionShape- Throws:
IOException
-
read
- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classCollisionShape- Throws:
IOException
-