public void tileAttached(Vector3f cell, TerrainQuad quad) { while(quad.getControl(RigidBodyControl.class)!=null){ quad.removeControl(RigidBodyControl.class); } quad.addControl(new RigidBodyControl(new HeightfieldCollisionShape(quad.getHeightMap(), terrain.getLocalScale()), 0)); bulletAppState.getPhysicsSpace().add(quad); }
/** * Instantiate a new shape for the specified height map. * * @param heightmap (not null, length≥4, length a perfect square) */ public HeightfieldCollisionShape(float[] heightmap) { createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ); }
/** * Instantiate the configured shape in Bullet. */ protected void createShape() { bbuf = BufferUtils.createByteBuffer(heightfieldData.length * 4); // fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData); // fbuf.rewind(); // fbuf.put(heightfieldData); for (int i = 0; i < heightfieldData.length; i++) { float f = heightfieldData[i]; bbuf.putFloat(f); } // fbuf.rewind(); objectId = createShape(heightStickWidth, heightStickLength, bbuf, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges); Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(objectId)); setScale(scale); setMargin(margin); }
protected void createShape() { HeightfieldTerrainShape shape = new HeightfieldTerrainShape(heightStickWidth, heightStickLength, heightfieldData, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges); shape.setLocalScaling(new javax.vecmath.Vector3f(scale.x, scale.y, scale.z)); cShape = shape; cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }
protected void createShape() { HeightfieldTerrainShape shape = new HeightfieldTerrainShape(heightStickWidth, heightStickLength, heightfieldData, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges); shape.setLocalScaling(new javax.vecmath.Vector3f(scale.x, scale.y, scale.z)); cShape = shape; cShape.setLocalScaling(Converter.convert(getScale())); cShape.setMargin(margin); }
protected void createShape() { bbuf = BufferUtils.createByteBuffer(heightfieldData.length * 4); // fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData); // fbuf.rewind(); // fbuf.put(heightfieldData); for (int i = 0; i < heightfieldData.length; i++) { float f = heightfieldData[i]; bbuf.putFloat(f); } // fbuf.rewind(); objectId = createShape(heightStickWidth, heightStickLength, bbuf, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges); Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Created Shape {0}", Long.toHexString(objectId)); setScale(scale); setMargin(margin); }
public void tileAttached(Vector3f cell, TerrainQuad quad) { while(quad.getControl(RigidBodyControl.class)!=null){ quad.removeControl(RigidBodyControl.class); } quad.addControl(new RigidBodyControl(new HeightfieldCollisionShape(quad.getHeightMap(), terrain.getLocalScale()), 0)); bulletAppState.getPhysicsSpace().add(quad); }
/** * Instantiate a new shape for the specified height map and scale vector. * * @param heightmap (not null, length≥4, length a perfect square) * @param scale (not null, no negative component, unaffected, default=1,1,1) */ public HeightfieldCollisionShape(float[] heightmap, Vector3f scale) { createCollisionHeightfield(heightmap, scale); }
public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); heightStickWidth = capsule.readInt("heightStickWidth", 0); heightStickLength = capsule.readInt("heightStickLength", 0); heightScale = capsule.readFloat("heightScale", 0); minHeight = capsule.readFloat("minHeight", 0); maxHeight = capsule.readFloat("maxHeight", 0); upAxis = capsule.readInt("upAxis", 1); heightfieldData = capsule.readFloatArray("heightfieldData", new float[0]); flipQuadEdges = capsule.readBoolean("flipQuadEdges", false); createShape(); }
protected void createShape() { bbuf = BufferUtils.createByteBuffer(heightfieldData.length * 4); // fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData); // fbuf.rewind(); // fbuf.put(heightfieldData); for (int i = 0; i < heightfieldData.length; i++) { float f = heightfieldData[i]; bbuf.putFloat(f); } // fbuf.rewind(); objectId = createShape(heightStickWidth, heightStickLength, bbuf, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges); Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(objectId)); setScale(scale); setMargin(margin); }
public void tileAttached(Vector3f cell, TerrainQuad quad) { //workaround for bugged test j3o's while(quad.getControl(RigidBodyControl.class)!=null){ quad.removeControl(RigidBodyControl.class); } quad.addControl(new RigidBodyControl(new HeightfieldCollisionShape(quad.getHeightMap(), terrain.getLocalScale()), 0)); bulletAppState.getPhysicsSpace().add(quad); }
public HeightfieldCollisionShape(float[] heightmap) { createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ); }
/** * De-serialize this shape, for example when loading from a J3O file. * * @param im importer (not null) * @throws IOException from importer */ public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule capsule = im.getCapsule(this); heightStickWidth = capsule.readInt("heightStickWidth", 0); heightStickLength = capsule.readInt("heightStickLength", 0); heightScale = capsule.readFloat("heightScale", 0); minHeight = capsule.readFloat("minHeight", 0); maxHeight = capsule.readFloat("maxHeight", 0); upAxis = capsule.readInt("upAxis", 1); heightfieldData = capsule.readFloatArray("heightfieldData", new float[0]); flipQuadEdges = capsule.readBoolean("flipQuadEdges", false); createShape(); } }
if (spatial instanceof TerrainQuad) { TerrainQuad terrain = (TerrainQuad) spatial; return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof TerrainPatch) { TerrainPatch terrain = (TerrainPatch) spatial; return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof Geometry) { return createSingleMeshShape((Geometry) spatial, spatial);
public HeightfieldCollisionShape(float[] heightmap, Vector3f scale) { createCollisionHeightfield(heightmap, scale); }
if (spatial instanceof TerrainQuad) { TerrainQuad terrain = (TerrainQuad) spatial; return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof TerrainPatch) { TerrainPatch terrain = (TerrainPatch) spatial; return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()); } else if (spatial instanceof Geometry) { return createSingleMeshShape((Geometry) spatial, spatial);
public HeightfieldCollisionShape(float[] heightmap) { createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ); }