congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
HeightfieldCollisionShape
Code IndexAdd Tabnine to your IDE (free)

How to use
HeightfieldCollisionShape
in
com.jme3.bullet.collision.shapes

Best Java code snippets using com.jme3.bullet.collision.shapes.HeightfieldCollisionShape (Showing top 20 results out of 315)

origin: jMonkeyEngine/jmonkeyengine

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);
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * 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);
}
origin: jMonkeyEngine/jmonkeyengine

  /**
   * 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);
  }
 
origin: jMonkeyEngine/jmonkeyengine

createShape();
origin: jMonkeyEngine/jmonkeyengine

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);
}
origin: jMonkeyEngine/jmonkeyengine

createShape();
origin: org.jmonkeyengine/jme3-jbullet

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);
}
origin: info.projectkyoto/mms-engine

  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);
  }
 
origin: jMonkeyEngine/jmonkeyengine

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);
}
origin: jMonkeyEngine/jmonkeyengine

/**
 * Instantiate a new shape for the specified height map and scale vector.
 *
 * @param heightmap (not null, length&ge;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);
}
origin: jMonkeyEngine/jmonkeyengine

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();
}
origin: org.jmonkeyengine/jme3-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);
  }
 
origin: jMonkeyEngine/jmonkeyengine

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);
}
origin: jMonkeyEngine/jmonkeyengine

public HeightfieldCollisionShape(float[] heightmap) {
  createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ);
}
origin: jMonkeyEngine/jmonkeyengine

  /**
   * 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();
  }
}
origin: jMonkeyEngine/jmonkeyengine

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);
origin: jMonkeyEngine/jmonkeyengine

public HeightfieldCollisionShape(float[] heightmap, Vector3f scale) {
  createCollisionHeightfield(heightmap, scale);
}
origin: org.jmonkeyengine/jme3-jbullet

createShape();
origin: jMonkeyEngine/jmonkeyengine

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);
origin: info.projectkyoto/mms-engine

public HeightfieldCollisionShape(float[] heightmap) {
  createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ);
}
com.jme3.bullet.collision.shapesHeightfieldCollisionShape

Javadoc

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.

Most used methods

  • <init>
  • createCollisionHeightfield
  • createShape
  • setMargin
  • setScale
  • getScale

Popular in Java

  • Updating database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now