Package com.jme3.math

Examples of com.jme3.math.Vector3f


    }

    @Override
    public void simpleInitApp() {
      instance = this;
        cam.setLocation(new Vector3f(3, 3, 3));
        cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);

        //setup main scene
        //Geometry quad = new Geometry("box", new Box(Vector3f.ZERO, 1,1,1));
        Geometry g = new Geometry("Bubble", new Bubble(1f, 4f));
View Full Code Here


    app.start();
  }

  @Override
  public void simpleInitApp() {
        cam.setLocation(new Vector3f(3, 3, 3));
        cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
       
    BubbleLine b = new BubbleLine(0.2f, 1);
    /*
    b.setMode(Mesh.Mode.Points);
 
View Full Code Here

    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
    rootNode.attachChild(g);

    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    rootNode.addLight(sun);
   
  }
View Full Code Here

    }

    public Vector3f getRandomPointInside(float yOffset) {
        float rAngle = random.nextFloat() * FastMath.TWO_PI;
        float rRadius = random.nextFloat() * radius;
        return new Vector3f(FastMath.cos(rAngle) * rRadius, yOffset, FastMath.sin(rAngle) * rRadius);
    }
View Full Code Here

        return location.getX() >= startX && location.getX() <= endX
                && location.getY() >= startY && location.getY() <= endY;
    }

    public Vector3f getRandomPointInside(float yOffset) {
        return new Vector3f(random.nextFloat() * (endX + FastMath.abs(startX)) - FastMath.abs(startX), yOffset, random.nextFloat() * (endY + FastMath.abs(startX)) - FastMath.abs(startY));
    }
View Full Code Here

        bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);

        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry g = new Geometry("b", b);
        BoxCollisionShape boxCollisionShape = new BoxCollisionShape(new Vector3f(1, 1, 1));
        g.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md" ));
        g.addControl(new RigidBodyControl(boxCollisionShape, 1));
        g.getControl(RigidBodyControl.class).setKinematic(true);
        bulletAppState.getPhysicsSpace().add(g);
        rootNode.attachChild(g);
View Full Code Here

        fade = new FadeFilter();
        fpp.addFilter(fade);

        water.setWaveScale(0.003f);
        water.setMaxAmplitude(1f);
        water.setFoamExistence(new Vector3f(1f, 4, 0.5f));
        water.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg"));

        water.setRefractionStrength(0.2f);

        water.setWaterHeight(initialWaterHeight);
        uw = cam.getLocation().y < waterHeight;

        waves = new AudioNode(assetManager, "Sounds/Environment/Ocean Waves.ogg", false);
        waves.setLooping(true);
        waves.setReverbEnabled(true);
        if (uw) {
            waves.setDryFilter(new LowPassFilter(0.5f, 0.1f));
        } else {
            waves.setDryFilter(aboveWaterAudioFilter);
        }

        getAudioRenderer().playSource(waves);
        getViewPort().addProcessor(fpp);

        flyCam.setMoveSpeed(100);

        cam.setLocation(new Vector3f(-186.47707f, 19.662216f, -72.307915f));
        cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

       // cc = new GameStartCinematic(this, fade);
        cc.attach();
        fade.setValue(0f);
View Full Code Here

                nd.attachChild(tree_1);
            }
        }

        DirectionalLight dl = new DirectionalLight();
        dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
        dl.setColor(new ColorRGBA(1, 1, 1, 1));
        rootNode.addLight(dl);


        AmbientLight al = new AmbientLight();
View Full Code Here

    }

    private void createCamMotionPath() {
        CameraNode seagull = cinematic.bindCamera("seagull", myApp.getCamera());
        seagull.setLocalTranslation(new Vector3f(-231.00694f, 269.15887f, 319.6499f));
        seagull.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
        //Motion1
        MotionPath path1 = new MotionPath();
        path1.addWayPoint(new Vector3f(-231.00694f, 269.15887f, 319.6499f));
        path1.addWayPoint(new Vector3f(-271.03436f, 274.78607f, 166.41858f));
        path1.addWayPoint(new Vector3f(-282.98575f, 198.66827f, -62.538017f));
        path1.addWayPoint(new Vector3f(-141.32166f, 241.95816f, -299.23657f));
        path1.addWayPoint(new Vector3f(69.37767f, 282.1654f, -395.867f));
        path1.setCurveTension(0.5f);
        seagullCamMotion1 = new MotionEvent(seagull, path1, 10f);
        seagullCamMotion1.setLookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
        seagullCamMotion1.setDirectionType(MotionEvent.Direction.LookAt);
        seagullCamMotion1.setLoopMode(LoopMode.DontLoop);

        //Motion2
        MotionPath path2 = new MotionPath();
        path2.addWayPoint(new Vector3f(69.37767f, 282.1654f, -395.867f));
        path2.addWayPoint(new Vector3f(49.096973f, 199.68199f, -280.14606f));
        path2.addWayPoint(new Vector3f(69.881424f, 80.421936f, -153.33533f));
        path2.addWayPoint(new Vector3f(92.93746f, 41.409966f, -79.42096f));
        path2.addWayPoint(new Vector3f(135.33469f, 37.869682f, -40.803993f));
        path2.addWayPoint(new Vector3f(232.73439f, 62.335537f, 4.7981267f));
        path2.addWayPoint(new Vector3f(151.06522f, 40.954773f, 108.32132f));
        path2.addWayPoint(new Vector3f(70.51622f, 30.993803f, 89.91843f));
        path2.addWayPoint(new Vector3f(-52.995872f, 27.911129f, 33.102673f));
        path2.addWayPoint(new Vector3f(-96.421425f, 27.326252f, -49.235554f));
        path2.addWayPoint(new Vector3f(-186.47707f, 19.662216f, -72.307915f));
        path2.addWayPoint(new Vector3f(-187f, 19.808556f, -72.36449f));

        path2.setCurveTension(0.6f);
        path2.setPathSplineType(SplineType.CatmullRom);
        seagullCamMotion2 = new MotionEvent(seagull, path2, 24f);
        seagullCamMotion2.setDirectionType(MotionEvent.Direction.Path);
View Full Code Here

        isTurned = false;
        calcTurn(useWalkAnimation);
    }

    private void calcTurn(boolean useWalkAnimation) {
        Vector3f worldTranslation = spatial.getWorldTranslation();
        Vector3f targetVec = new Vector3f(target);
        targetVec.setY(spatial.getLocalTranslation().getY());
        targetVec.subtractLocal(worldTranslation);
        turnFrom = spatial.getLocalRotation().clone();
        turnTo.lookAt(targetVec, Vector3f.UNIT_Y);
        float angle1 = FastMath.RAD_TO_DEG * turnTo.toAngles(null)[1];
        float angle2 = FastMath.RAD_TO_DEG * turnFrom.toAngles(null)[1];
        if (angle1 < 0f) {
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.