Package com.jme.scene.shape

Examples of com.jme.scene.shape.Box


        } else if (bounds instanceof BoundingBox) {
            float xExtent = ((BoundingBox)bounds).xExtent;
            float yExtent = ((BoundingBox)bounds).yExtent;
            float zExtent = ((BoundingBox)bounds).zExtent;
            Vector3f origin = ((BoundingBox)bounds).getCenter();
            Box box = new Box("Box", origin, xExtent, yExtent, zExtent);
            rootNode.attachChild(box);
        }

        // Fetch the world translation for the root node of the cell and set
        // the translation for this entity root node
View Full Code Here


    warhead.detonate(ray, TankGame.GAMESTATE.getRoot());
  }

  @Override
  public void onFire(Ray vector, Vector3f initialLinearVelocity, Node rootNode) {
    final Box model = new Box("missile", new Vector3f(0, 0, 0), 1f, 1f,
        4f);

    // attach the chain:
    // rootNode -> MissileFireable -> Geometry
    attachChild(model);
    // generate physics geom
    generatePhysicsGeometry();
    rootNode.attachChild(this);
   
   

    getLocalTranslation().set(vector.getOrigin());
    getLocalRotation().lookAt(vector.getDirection(),
        TankGame.GAMESTATE.UP);

    model.updateRenderState();
    setMaterial(Material.IRON);

    addController(new BasicPhysicsFireableController(this));
   
    final SyntheticButton detonator = getCollisionEventHandler();
View Full Code Here

  @Override
  protected void simpleInitGame() {
    try {
     
      box = new Box( "MyBox", new Vector3f( -2.0f, -2.0f, -2.0f ), new Vector3f( 2.0f, 2.0f, 2.0f ));
      box.setRandomColors();
      //box.setSolidColor( new ColorRGBA( 1.0f, 1.0f, 1.0f, 1.0f) );
      rootNode.attachChild( box );

      cam.setFrustumPerspective(45.0f, (float) display.getWidth()
View Full Code Here

    warhead.detonate(ray, other);
  }

  @Override
  public void onFire(Ray vector, Vector3f initialLinearVelocity, Node rootNode) {
    final Box model = new Box("missile", new Vector3f(0, 0, 0), 1f, 1f,
        4f);

    // attach the chain:
    // rootNode -> MissileFireable -> Geometry
    attachChild(model);
    // generate physics geom
    generatePhysicsGeometry();
    rootNode.attachChild(this);
   
   

    getLocalTranslation().set(vector.getOrigin());
    getLocalRotation().lookAt(vector.getDirection(),
        TankGame.GAMESTATE.UP);

    model.updateRenderState();
    setMaterial(Material.IRON);

    addController(new BasicPhysicsFireableController(this));
   
    final SyntheticButton detonator = getCollisionEventHandler();
View Full Code Here

    warhead.detonate(ray, other);
  }

  @Override
  public void onFire(Ray vector, Vector3f initialLinearVelocity, Node rootNode) {
    final Box model = new Box("missile", new Vector3f(0, 0, 0), 1f, 1f, 4f);

    // attach the chain:
    // rootNode -> MissileFireable -> Geometry
    attachChild(model);
    // generate physics geom
    generatePhysicsGeometry();
    rootNode.attachChild(this);
   
   

    getLocalTranslation().set(vector.getOrigin());
    getLocalRotation().lookAt(vector.getDirection(),
        TankGame.GAMESTATE.UP);

    model.updateRenderState();
    setMaterial(Material.IRON);

    addController(new MissileFireableController(this));
   
    final SyntheticButton detonator = getCollisionEventHandler();
View Full Code Here

        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    Box box = new Box( "box1", new Vector3f( -10, -10, -10 ), new Vector3f( 10, 10, 10 ) );
    box.setLocalTranslation( new Vector3f( 0, -7, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box2", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 15, 10, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box3", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 0, -10, 15 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box4", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 20, 0, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    box = new Box( "box5", new Vector3f( -50, -2, -50 ), new Vector3f( 50, 2, 50 ) );
    box.setLocalTranslation( new Vector3f( 0, -15, 0 ) );
    box.setRenderState( ts );
    box.setModelBound( new BoundingBox() );
    box.updateModelBound();
    objects.attachChild( box );

    return objects;
  }
View Full Code Here

        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    Box box = new Box( "box1", new Vector3f( -10, -10, -10 ), new Vector3f( 10, 10, 10 ) );
    box.setLocalTranslation( new Vector3f( 0, -7, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box2", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 15, 10, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box3", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 0, -10, 15 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    box = new Box( "box4", new Vector3f( -5, -5, -5 ), new Vector3f( 5, 5, 5 ) );
    box.setLocalTranslation( new Vector3f( 20, 0, 0 ) );
    box.setRenderState( ts );
    objects.attachChild( box );

    ts = display.getRenderer().createTextureState();
    t0 = TextureManager.loadTexture(
        TestSimpleQuadWater.class.getClassLoader().getResource(
            "jmetest/data/images/Monkey.jpg" ),
        Texture.MM_LINEAR_LINEAR,
        Texture.FM_LINEAR );
    t0.setWrap( Texture.WM_WRAP_S_WRAP_T );
    ts.setTexture( t0 );

    box = new Box( "box5", new Vector3f( -50, -2, -50 ), new Vector3f( 50, 2, 50 ) );
    box.setLocalTranslation( new Vector3f( 0, -15, 0 ) );
    box.setRenderState( ts );
    box.setModelBound( new BoundingBox() );
    box.updateModelBound();
    objects.attachChild( box );

    return objects;
  }
View Full Code Here

    @Override
    protected void simpleInitGame() {
        WireframeState ws = display.getRenderer().createWireframeState();
        ws.setEnabled(true);
       
        box1 = new Box("box1", new Vector3f(30, 0, -120), 20, 20, 20);
        box1.setRenderState(ws);
        box1.updateRenderState();
       
        box2 = new Box("box2", new Vector3f(-30, 0, -120), 20, 20, 20);
        box2.setRenderState(ws);
        box2.updateRenderState();
    }
View Full Code Here

        MaterialState materialp = display.getRenderer().createMaterialState();
        materialp.setShininess( 128 );
        ColorRGBA color = new ColorRGBA( 0.5f, 0.5f, 0.5f, 0.1f );
        materialp.setDiffuse( color );
        materialp.setAmbient( color.mult( new ColorRGBA( 0.5f, 0.5f, 0.5f, 0.1f ) ) );
        planeXY=new Box("planeXY",new Vector3f(0.05f,0,0.05f),0.1f,0.0001f,0.1f);
        planeXY.setRenderState(materialp);

        MaterialState materialx = display.getRenderer().createMaterialState();
        materialx.setShininess( 128 );
        color = new ColorRGBA( 1f, 0f, 0f, 0.1f );
        materialx.setDiffuse( color );
        materialx.setAmbient( color.mult( new ColorRGBA( 1f, 0.1f, 0.1f, 1 ) ) );



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

        MaterialState materialy = display.getRenderer().createMaterialState();
        materialy.setShininess( 128 );
        color = new ColorRGBA( 0f, 1f, 0f, 0.5f );
        materialy.setDiffuse( color );
        materialy.setAmbient( color.mult( new ColorRGBA( 0.1f, 1f, 0.1f, 0.5f ) ) );

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

        MaterialState materialz = display.getRenderer().createMaterialState();
        materialz.setShininess( 128 );
        color = new ColorRGBA( 0f, 0f, 1f, 0.5f );
        materialz.setDiffuse( color );
        materialz.setAmbient( color.mult( new ColorRGBA( 0.1f, 0.1f, 1f, 0.5f ) ) );

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

        camPosBall=new Sphere("cameraPosition",new Vector3f(0,0,0),10,10,0.02f);


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



        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

        subNode[0] = new Node("spheres");
        subNode[0].setRenderState(Tool.createXRayShader());
        triMesh[0] = new Sphere("sphere", new Vector3f(0, 0, 0), 10, 10, 5);
        triMesh[0].setModelBound(new BoundingSphere());
        subNode[1] = new Node("boxes");
        triMesh[1] = new Box("box", new Vector3f(0, 0, 0), 5, 5, 5);
        triMesh[1].setModelBound(new BoundingBox());
        subNode[2] = new Node("toruses");
        triMesh[2] = new Torus("torus", 10, 10, 2, 3);
        triMesh[2].setModelBound(new BoundingBox());
        subNode[3] = new Node("cylinders");
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.