Package com.jme3.bounding

Examples of com.jme3.bounding.BoundingSphere


      return getBoundingSphere((Geometry)s);
   
    if(s instanceof Node)
      {
      Node n = (Node)s;
      BoundingVolume result = new BoundingSphere();
      int validChildCount = 0;
      for(Spatial cs : n.getChildren())
        {
        BoundingVolume bs = getBoundingSphere(cs);
        if(bs != null)
          {
          result = result.merge(bs);
          ++validChildCount;
          }
        }
     
      if(validChildCount > 0)
View Full Code Here


   * Calculates the BoundingSphere for a Geometry
   */
  public static BoundingSphere getBoundingSphere(Geometry g)
    {
    VertexBuffer posBuffer = g.getMesh().getBuffer(Type.Position);
    BoundingSphere bs = new BoundingSphere();
    bs.computeFromPoints((FloatBuffer)posBuffer.getData());

    return bs;
    }
View Full Code Here

        this.getFlyByCamera().setUpVector(Vector3f.UNIT_Z);
        cameraGuessBestPosition();
    }
   
    private void cameraGuessBestPosition() {
      this.rootNode.setModelBound(new BoundingSphere());
    float radius = ((BoundingSphere)this.rootNode.getWorldBound()).getRadius();
    Vector3f center = ((BoundingSphere)this.rootNode.getWorldBound()).getCenter();
    float cameraNewX = radius + radius/2;
    float cameraNewZ = radius + radius/2;
    float cameraOldY = radius + radius/2;
View Full Code Here

                g.setName("Bound");
                g.setMaterial(DebugMaterials.boundMat);
                g.getMesh().setLineWidth(2f);
                return g;
            case Sphere:
                BoundingSphere bSphere = (BoundingSphere) boundVolume;
                Sphere s = new Sphere(8, 8, bSphere.getRadius());
                s.setMode(Mode.Lines);
                g = new Geometry("Bound", s);
                g.setMaterial(DebugMaterials.boundMat);
                g.setLocalRotation(refGeom.getWorldRotation());
                return g;
View Full Code Here

        world.setViewDistance(viewDistance);

        camFrustum = new CameraFrustum(cam);

        worldBound = new BoundingSphere(viewDistance * 1.1f, cam.getLocation());
    }
View Full Code Here

    entities.add(entity);
    mapNode.attachChild(entity);
  }
 
  public CollisionResults getCollisions(Ray ray) {
    CollisionResults results = new CollisionResults();
    mapNode.collideWith(ray, results);
    return results;
  }
View Full Code Here

  public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    tuioInput = TuioInput.get();
    tuioInput.addListener(this);
    BitmapFont guiFont = app.getAssetManager().loadFont("Interface/Fonts/Default.fnt");
   
    BitmapText tuioStatsLabel = new BitmapText(guiFont, false);
        tuioStatsLabel.setLocalTranslation(0, tuioStatsLabel.getLineHeight()*3, 0);
        tuioStatsLabel.setText("Tuio Input:");
        tuioStatsNode.attachChild(tuioStatsLabel);
View Full Code Here

    super.initialize(stateManager, app);
    tuioInput = TuioInput.get();
    tuioInput.addListener(this);
    BitmapFont guiFont = app.getAssetManager().loadFont("Interface/Fonts/Default.fnt");
   
    BitmapText tuioStatsLabel = new BitmapText(guiFont, false);
        tuioStatsLabel.setLocalTranslation(0, tuioStatsLabel.getLineHeight()*3, 0);
        tuioStatsLabel.setText("Tuio Input:");
        tuioStatsNode.attachChild(tuioStatsLabel);
   
        tuioStatsText = new BitmapText(guiFont, false);
        tuioStatsText.setLocalTranslation(80, tuioStatsText.getLineHeight()*3, 0);
        tuioStatsText.setText("");
        tuioStatsNode.attachChild(tuioStatsText);
       
        tuioStatsText2 = new BitmapText(guiFont, false);
        tuioStatsText2.setLocalTranslation(80, tuioStatsText2.getLineHeight()*2, 0);
        tuioStatsText2.setText("");
        tuioStatsNode.attachChild(tuioStatsText2);
  }
View Full Code Here

  public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    //cam = app.getCamera();
    assetManager = app.getAssetManager();
        guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
        fpsText = new BitmapText(guiFont, false);
        fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);
        fpsText.setText("Frames per second");
        //camText = new BitmapText(guiFont, false);
        //camText.setLocalTranslation(0, camText.getLineHeight()*5, 0);
        //camText.setText("Cam: ");
View Full Code Here

     * Attaches FPS statistics to guiNode and displays it on the screen.
     *
     */
    public void loadFPSText() {
        guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
        fpsText = new BitmapText(guiFont, false);
        fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);
        fpsText.setText("Frames per second");
        guiNode.attachChild(fpsText);
    }
View Full Code Here

TOP

Related Classes of com.jme3.bounding.BoundingSphere

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.