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
Modifier and TypeFieldDescriptionprotected boolean
protected float[]
protected float
protected int
protected int
protected float
protected float
protected int
Fields inherited from class com.jme3.bullet.collision.shapes.CollisionShape
cShape, margin, scale
-
Constructor Summary
ModifierConstructorDescriptionprotected
HeightfieldCollisionShape
(float[] heightmap) HeightfieldCollisionShape
(float[] heightmap, Vector3f scale) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
createCollisionHeightfield
(float[] heightmap, Vector3f worldScale) protected void
void
read
(JmeImporter im) void
write
(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:
write
in interfaceSavable
- Overrides:
write
in classCollisionShape
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classCollisionShape
- Throws:
IOException
-