Package com.jme.scene.shape

Examples of com.jme.scene.shape.Box


        // vrznu doprostred sceny torus aby byla dobre videt pruhlednost na testovanem boxu
        Torus torus = new Torus("torus", 20, 50, 2, 3);
        rootNode.attachChild(torus);

        // testovany box
        box = new Box("box", Vector3f.ZERO, 10, 10, 10);

        // texture state se dvemi texturami
        TextureState ts = display.getRenderer().createTextureState();
        Texture t01 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/rgb.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        Texture t02 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/mask.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
View Full Code Here


    protected void simpleInitGame() {
        //Definice sipek pro orientaci v prostoru

        axisRoot=new Node("axnode");
        axisRoot.setLocalTranslation(0, 0, 0);
        planeXY=new Box("planeXY",new Vector3f(0.05f,0,0.05f),0.1f,0.0001f,0.1f);

        axisXArrow=new Arrow("ax",0.1f,0.01f);
        axisXArrow.setLocalTranslation(new Vector3f(0.05f,0,0));
        axisXArrow.rotateUpTo(new Vector3f(1,0,0));
       
       

        axisYArrow=new Arrow("ay",0.1f,0.01f);
        axisYArrow.setLocalTranslation(new Vector3f(0,0.05f,0));
        axisYArrow.rotateUpTo(new Vector3f(0,1,0));

        axisZArrow=new Arrow("az",0.1f,0.01f);
        axisZArrow.setLocalTranslation(new Vector3f(0,0,0.05f));
        axisZArrow.rotateUpTo(new Vector3f(0,0,1));

        axisRoot.attachChild(axisXArrow);
        axisRoot.attachChild(axisYArrow);
        axisRoot.attachChild(axisZArrow);
        axisRoot.attachChild(planeXY);

        rootNode.attachChild(axisRoot);
       

        shipNode = getPhysicsSpace().createDynamicNode();

        // The ship is represent by filled blok of oak tree wood with dimensions
        // 30x12x2 meters (units are lowered by 10000)
        ((DynamicPhysicsNodeImpl) shipNode).getBody().setMassParameters(4.32f, 0f, 0f, 0f, 532.8f, 3758.4f, 3254.4f, 0, 0, 0);

        Box sh = new Box("ship", new Vector3f(0, 0, 0), 15, 1, 6);
        //Box sh = new Box("ship", new Vector3f(0, 0, 0), 1, 1, 1);

        shipNode.setAffectedByGravity(false); // shipNode.setLocalScale(new
        // Vector3f(10,10,10));
        shipNode.getLocalTranslation().set(0, 0, 0);
View Full Code Here

        // vrznu doprostred sceny torus aby byla dobre videt pruhlednost na testovanem boxu
        Torus torus = new Torus("torus", 20, 50, 2, 3);
        rootNode.attachChild(torus);

        // testovany box
        box = new Box("box", Vector3f.ZERO, 10, 10, 10);

        // texture state se dvemi texturami
        TextureState ts = display.getRenderer().createTextureState();
        Texture t01 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/rgb.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
        Texture t02 = TextureManager.loadTexture(getClass().getResource("/textures/pattern/mask.bmp"), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, 1.0f, true);
View Full Code Here

      dz = Vm * cosZ + ze;
       
      // Create the bullet and translate it to be in the center of the barrel.
      // This doesn't end up looking all that great at the moment, but its a
      // start.  Also, set the size, color and bounding box of the bullet.
      Box box = new Box("position"+t, new Vector3f(-.5f, -.5f, -.5f), new Vector3f(.5f, .5f, .5f));
      box.setLocalTranslation(new Vector3f(xe, Yb, ze));
      box.setLocalScale(3f);
    box.setDefaultColor(ColorRGBA.red);
    box.setModelBound(new BoundingBox());
    box.updateModelBound();
   
    // Create a node for the missle trajectory.  This makes it possible to apply
    // a light state to the bullets.  Now that I think of it, this could probably
    // be removed by applying the LightState to the rootNode... but I don't really
    // know... too tired to try.
    Node missleTrajectory2 = new Node("missleTrajectory");
      missleTrajectory2.attachChild(box);
     
      // Don't know what this is doing really.... see comments below
        LightState ls = display.getRenderer().createLightState();
        ls.setEnabled(false);
        missleTrajectory2.setRenderState(ls);
        missleTrajectory2.updateRenderState();
       
        //  Add the controller class to the box. Notice, I am passing the
        //  missleTrajectory2 node to the BulletMover class.  This is so the
        //  bullet can be removed from the rootNode when it times out.  If
        //  I could remove the missleTrajectory2 junk, I could make it a lot simpler.
        box.addController(new BulletMover(this, box, new Vector3f(dx,dy,dz),missleTrajectory2));
        rootNode.attachChild(missleTrajectory2);
    }
View Full Code Here

      dz = Vm * cosZ + ze;
       
      // Create the bullet and translate it to be in the center of the barrel.
      // This doesn't end up looking all that great at the moment, but its a
      // start.  Also, set the size, color and bounding box of the bullet.
      Box box = new Box("position"+t, new Vector3f(-.5f, -.5f, -.5f), new Vector3f(.5f, .5f, .5f));
      box.setLocalTranslation(new Vector3f(xe, Yb, ze));
      box.setLocalScale(3f);
    box.setDefaultColor(ColorRGBA.red);
    box.setModelBound(new BoundingBox());
    box.updateModelBound();
   
    // Create a node for the missle trajectory.  This makes it possible to apply
    // a light state to the bullets.  Now that I think of it, this could probably
    // be removed by applying the LightState to the getRootNode()... but I don't really
    // know... too tired to try.
    Node missleTrajectory2 = new Node("missleTrajectory");
      missleTrajectory2.attachChild(box);
     
      // Don't know what this is doing really.... see comments below
        LightState ls = getRenderer().createLightState();
        ls.setEnabled(false);
        missleTrajectory2.setRenderState(ls);
        missleTrajectory2.updateRenderState();
       
        //  Add the controller class to the box. Notice, I am passing the
        //  missleTrajectory2 node to the BulletMover class.  This is so the
        //  bullet can be removed from the getRootNode() when it times out.  If
        //  I could remove the missleTrajectory2 junk, I could make it a lot simpler.
        box.addController(new BulletMover(this, box, new Vector3f(dx,dy,dz),missleTrajectory2));
        getRootNode().attachChild(missleTrajectory2);
    }
View Full Code Here

TOP

Related Classes of com.jme.scene.shape.Box

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.