Package com.jme3.scene

Examples of com.jme3.scene.Geometry


    }


   
    private void dropBox() {
      Geometry g = new Geometry("Box",new Box());
      g.setMaterial(matWireframe);
      Vector3f pos = cam.getLocation().clone();
      sin.getNavManager().snapToGround(pos);
      sin.getSceneManager().changeAnyNode(rootNode, g, Action.ADD);
     
  }
View Full Code Here


        Node node = new Node("NavBorderMeshes");
        Material mat = matWireframe.clone();
            mat.setColor("Color", ColorRGBA.Blue);
        TiledNavMesh[] array = Singleton.get().getNavManager().getNavMeshes();
        for(TiledNavMesh t : array){
          Geometry g = t.getDebugBorderMesh();
          g.setMaterial(mat);
          node.attachChild(g);
        }
        navs.attachChild(node);
      }
    }
View Full Code Here

    private void toggelNavMeshes(){
      if(nav.getChildren().size() > 0){
        nav.detachAllChildren();
      } else {
        if(navMesh != null) {
          Geometry db = navMesh.getDebugMesh();
          db.setMaterial(this.matWireframe.clone());
          nav.attachChild(db)
        }
      }
    }
View Full Code Here

        border.detachAllChildren();
      } else {
        if(navMesh != null) {
            Material mat = matWireframe.clone();
                mat.setColor("Color", ColorRGBA.Blue);
          Geometry db = navMesh.getDebugBorderMesh();
          //we just put it slightly off to beter see the border
          db.setLocalTranslation(new Vector3f(0f, 0.5f, 0f).addLocal(db.getLocalTranslation()));
          System.out.println("Border has "+db.getVertexCount()+" vertices");
          db.setMaterial(mat);
          border.attachChild(db)
        }
      }
    }
View Full Code Here

        e1.printStackTrace();
      }
     
     
      Box b = new Box(.5f,1f,.5f);
      Geometry walker = new Geometry("wakler", b);
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Red);
        walker.setMaterial(mat);
        Entity e = placeObject(new Vector3f(257f,2.2f,0f), new Vector3f(389f,0f,0f));
        if(e != null){
          e.attachChild(walker);
          rootNode.attachChild(e);
          this.walker = e;
        }

     
      Box b2 = new Box(.6f, .3f, .6f);
      Geometry g2 = new Geometry("tgt", b2);
      Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat2.setColor("Color", ColorRGBA.Green);
        g2.setMaterial(mat2);
        Vector3f p = new Vector3f(256f,2.2f,0f);
        enm.snapToGround(p);
        g2.setLocalTranslation(p);
      rootNode.attachChild(g2);
    }
View Full Code Here

      int x, int y, int z) {
    try {
//      NavigationMesh m = getNavMesh(meshFile+".jnv", 128, x, y, z);
      TiledNavMesh m = getMeshNav(meshFile, IArea.TERRAIN_SIZE, x, y, z);
      em.attachMesh(m);
      Geometry grid = (Geometry) assetManager.loadAsset(meshFile);
      grid.setLocalTranslation(x, y, z);
//          Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.LightGray);
//      grid.setMaterial(mat);
      grid.updateGeometricState();
      rootNode.attachChild(grid);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

   
    private Spatial getQuad(float size, float x, float y, float z){
      Quad q = new Quad(size,size,true);
        //Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", q);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", assetManager.loadTexture("com/l2client/test/material/chterraingrass01_n.dds"));
        geom.setMaterial(mat);
//        geom.setLocalTranslation((-0.5f*size)+x,(-0.5f*size)+y,z); 
        geom.rotate(-FastMath.HALF_PI, 0, 0);
        geom.setLocalTranslation((-0.5f*size)+x,y,(0.5f*size)+z);
       
        return geom;
    }
View Full Code Here

      return (TiledNavMesh) BinaryImporter.getInstance().load(new File(file));
    }
   
    private TiledNavMesh getMeshNav(String file, float size, float x, float y, float z){
    TiledNavMesh m;
    Geometry g00 = (Geometry) assetManager.loadAsset(file);
    if(g00 == null){
      System.out.println("Asset for "+file+"is missing");
      return null;
    }
    g00.setLocalTranslation(x,y,z);
    g00.updateGeometricState();
    m = new TiledNavMesh();
       
    m.loadFromGeom(g00);
    return m;
    }
View Full Code Here

      int x, int y, int z) {
    try {
//      NavigationMesh m = getNavMesh(meshFile+".jnv", 128, x, y, z);
      TiledNavMesh m = getMeshNav(meshFile, 128, x, y, z);
      em.attachMesh(m);
      Geometry grid = (Geometry) assetManager.loadAsset(meshFile);
      grid.setLocalTranslation(x, y, z);
//          Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.LightGray);
//      grid.setMaterial(mat);
      grid.updateGeometricState();
      rootNode.attachChild(grid);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

   
    private Spatial getQuad(float size, float x, float y, float z){
      Quad q = new Quad(size,size,true);
        //Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", q);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", assetManager.loadTexture("com/l2client/test/material/chterraingrass01_n.dds"));
        geom.setMaterial(mat);
//        geom.setLocalTranslation((-0.5f*size)+x,(-0.5f*size)+y,z); 
        geom.rotate(-FastMath.HALF_PI, 0, 0);
        geom.setLocalTranslation((-0.5f*size)+x,y,(0.5f*size)+z);
       
        return geom;
    }
View Full Code Here

TOP

Related Classes of com.jme3.scene.Geometry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.