Package com.jme3.math

Examples of com.jme3.math.Vector3f


        terrain.setLocalTranslation(0, -100, 0);
        terrain.setLocalScale(1f, 1f, 1f);
        rootNode.attachChild(terrain);

        DirectionalLight light = new DirectionalLight();
        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
        rootNode.addLight(light);

        AmbientLight ambLight = new AmbientLight();
        ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
        rootNode.addLight(ambLight);

        cam.setLocation(new Vector3f(0, 10, -10));
        cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
        cam.setFrustumFar(10000f);
    }
View Full Code Here


    @Override
    public void simpleInitApp() {

      sin.init(AreaTerrainManager.get());
      cam.setLocation(new Vector3f(390f,10f,10f));
      cam.setFrustumFar(1000f);
      cam.setFrustumNear(1f);
      cam.lookAt(new Vector3f(256f,0,0), Vector3f.UNIT_Y);
      flyCam.setMoveSpeed(50f);
     
    assetManager = sin.getAssetManager().getJmeAssetMan();
      enm = sin.getNavManager();
      enm.USE_OPTIMZED_PATH = true;
      em = sin.getEntityManager();
      sm = sin.getSceneManager();
      am = sin.getTerrainManager();
      js = sin.getJmeSystem();
      ps = sin.getPosSystem();
    am.update(cam.getLocation());
      rootNode.attachChild(debugNodes);

        DirectionalLight light = new DirectionalLight();
        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
        rootNode.addLight(light);

        AmbientLight ambLight = new AmbientLight();
        ambLight.setColor(new ColorRGBA(0.2f, 0.2f, 0.2f, 1f));
        rootNode.addLight(ambLight);
     

     
      rootNode.attachChild(scene);
      sm.setRoot(scene);

      while(enm.getMeshCount()<8)
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e1) {
        // TODO Auto-generated catch block
        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

    }

    @Override
    public void simpleInitApp() {
      sin.init(SimpleTerrainManager.get());
      cam.setLocation(new Vector3f(-9980f,50f,8450f));
      cam.setFrustumFar(1000f);
      cam.setFrustumNear(1f);
      cam.lookAt(new Vector3f(-9880f,10f,8350), Vector3f.UNIT_Y);
      flyCam.setMoveSpeed(50f);
     
    assetManager = sin.getAssetManager().getJmeAssetMan();
    debugNodes.setLocalTranslation(Vector3f.UNIT_Y.mult(0.1f));
      rootNode.attachChild(debugNodes);

        DirectionalLight light = new DirectionalLight();
        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
        rootNode.addLight(light);

        AmbientLight ambLight = new AmbientLight();
        ambLight.setColor(new ColorRGBA(0.2f, 0.2f, 0.2f, 1f));
        rootNode.addLight(ambLight);
     

        Asset a = new Asset("/tile/121_177/121_177.jnv", "/tile/121_177/121_177.jnv");
        sin.getAssetManager().loadAsset(a, true);
        if(a.getBaseAsset() instanceof TiledNavMesh )
          NavTestHelper.debugShowMesh(assetManager, debugNodes,(TiledNavMesh) a.getBaseAsset());
       
        Asset b = new Asset("/tile/121_177/121_177.j3o", "/tile/121_177/121_177.j3o");
        sin.getAssetManager().loadAsset(b, true);
        if(b.getBaseAsset() instanceof Spatial ) {
          Spatial n = (Spatial)b.getBaseAsset();
//      Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.randomColor());
        Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Light/Lighting.j3md");
        mat.setBoolean("UseMaterialColors",true);   
        mat.setColor("Diffuse",ColorRGBA.randomColor());
        n.setLocalTranslation(Tile.getWorldPositionOfXTile(121)+IArea.TERRAIN_SIZE_HALF, 0f,Tile.getWorldPositionOfZTile(177)-IArea.TERRAIN_SIZE_HALF);
          n.setMaterial(mat);
          rootNode.attachChild(n);
        }
        /*       System.out.println("tile x=121 should be world -9984:"+getWorldPositionOfXTile(121));
       System.out.println("tile x=122 should be world -9728:"+getWorldPositionOfXTile(122));
       System.out.println("tile z=176 should be world 8192:"+getWorldPositionOfZTile(176));
       System.out.println("tile z=177 should be world 8448:"+getWorldPositionOfZTile(177));*/
        NavTestHelper.debugShowBox(assetManager, debugNodes, new Vector3f(-9984f+IArea.TERRAIN_SIZE_HALF,0f,8448f-IArea.TERRAIN_SIZE_HALF), ColorRGBA.LightGray, IArea.TERRAIN_SIZE_HALF, 0.1f, IArea.TERRAIN_SIZE_HALF);

        inputManager.addListener(this, "print_scenegraph");
        inputManager.addMapping("print_scenegraph", new KeyTrigger(KeyInput.KEY_F6));

    }
View Full Code Here

       
//        NavTestHelper.debugShowPath(assetManager, rootNode, p);
//        NavTestHelper.areCellsConnected(p);
//        NavTestHelper.arePointsInCells(p);
//        NavTestHelper.findPath(em, new Vector3f(0,0,-62), new Vector3f(0,0,-66));
        p= NavTestHelper.walkPath(em,  new Vector3f(0,0,-62), new Vector3f(0,0,-66), 8f);
        if(p != null){
        NavTestHelper.debugShowPath(assetManager, rootNode, p);
        NavTestHelper.debugShowCost(assetManager, rootNode, p, ColorRGBA.Cyan);
        }
    }
View Full Code Here

        @Override
        public Object call() throws Exception {
          debugNodes.detachAllChildren();
            Path p = new Path();
//          p = NavTestHelper.findPath(em, new Vector3f(1.1f,0,1f), new Vector3f(3.1f,0,3f));
          p = NavTestHelper.findPath(em, new Vector3f(260f,0,-20f), new Vector3f(270f,0,10f));
          if(p != null){
//            p.optimize();
          NavTestHelper.debugShowCost(assetManager, debugNodes, p, ColorRGBA.Cyan);
          NavTestHelper.debugShowPath(assetManager, debugNodes, p);
          NavTestHelper.areCellsConnected(p);
View Full Code Here

    return m;
    }
   
    private TiledNavMesh getNavMesh(String name, Vector3f worldtrans){
      TiledNavMesh m = new TiledNavMesh();
      m.loadFromData(new Vector3f[] {new Vector3f(-IArea.TERRAIN_SIZE_HALF,0,IArea.TERRAIN_SIZE_HALF),new Vector3f(-IArea.TERRAIN_SIZE_HALF,0,-IArea.TERRAIN_SIZE_HALF), new Vector3f(IArea.TERRAIN_SIZE_HALF,0,-IArea.TERRAIN_SIZE_HALF), new Vector3f(IArea.TERRAIN_SIZE_HALF,0,IArea.TERRAIN_SIZE_HALF)}, new short[][] {{0,2,1},{0,3,2}}, worldtrans);
      return m;
    }
View Full Code Here

     
      man.loadParts("megaset.csv");
        
        //move cam a bit closer
//        cam.setLocation(cam.getLocation().mult(-1f));
      cam.lookAt(new Vector3f(0,2f,0), Vector3f.UNIT_Y);
        inputManager.setCursorVisible(true);
        flyCam.setEnabled(false);
       
        DirectionalLight dr = new DirectionalLight();
        dr.setColor(ColorRGBA.White);
        dr.setDirection(new Vector3f(1, 0 , 1));
       
        AmbientLight am = new AmbientLight();
        am.setColor(ColorRGBA.White);
        rootNode.addLight(am);
        rootNode.addLight(dr);
View Full Code Here

        @Override
        public Object call() throws Exception {
         
          debugNodes.detachAllChildren();
            Path p = new Path();
          p = NavTestHelper.findPath(em, new Vector3f(1.1f,0,1f), new Vector3f(3.1f,0,3f));
          if(p != null){
          int s = p.WaypointList().size();
          for(int i =s-1;i>run;i--)
            p.WaypointList().remove(i);
          NavTestHelper.debugShowCost(assetManager, debugNodes, p, ColorRGBA.Cyan);
View Full Code Here

    return m;
    }
   
    private TiledNavMesh getNavMesh(String name, Vector3f worldtrans){
      TiledNavMesh m = new TiledNavMesh();
      m.loadFromData(new Vector3f[] {new Vector3f(-64,0,64),new Vector3f(-64,0,-64), new Vector3f(64,0,-64), new Vector3f(64,0,64)}, new short[][] {{0,2,1},{0,3,2}}, worldtrans);
      return m;
    }
View Full Code Here

    private void setupScene() {
      Singleton.get().init(null);
     
        DirectionalLight dr = new DirectionalLight();
        dr.setColor(ColorRGBA.White);
        dr.setDirection(new Vector3f(1, 0 , 1));
       
        AmbientLight am = new AmbientLight();
        am.setColor(ColorRGBA.White);
        rootNode.addLight(am);
        rootNode.addLight(dr);
View Full Code Here

TOP

Related Classes of com.jme3.math.Vector3f

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.