Package com.jme3.math

Examples of com.jme3.math.Vector3f


    public void addPhysicsControl() {
        player = new CharacterControl(getCollisionShape(), 0.1f);
        player.setJumpSpeed(20);
        player.setFallSpeed(30);
        player.setGravity(30);
        player.setPhysicsLocation(new Vector3f(0, 10, 0));
        player.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_03);
        player.setCollideWithGroups(PhysicsCollisionObject.COLLISION_GROUP_01 | PhysicsCollisionObject.COLLISION_GROUP_02 | PhysicsCollisionObject.COLLISION_GROUP_04);
        bulletAppState.getPhysicsSpace().add(player);

        spatial.addControl(player);
View Full Code Here


        super();
    }

    public void createBlock (Vector3f extents) {
        this.extents = extents;
        Box b = new Box(new Vector3f(-extents.x, -extents.y, -extents.z), extents);
        Geometry box = new Geometry("block", b);
        spatial = box;
    }
View Full Code Here

        return currentLevel;
    }

    // only call this once during the first ever level
    public void initialiseGameStatesOnce() {
        myApp.getCamera().setLocation(new Vector3f(-231.00694f, 269.15887f, 319.6499f));
        myApp.getCamera().lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

        // Load LevelCommon

        // Load Island
        island = (Node) myApp.getAssetManager().loadModel("Scenes/island2_1.j3o");
View Full Code Here

        Node[] foodSpawnLocations = new Node[]{level1Food}; //level2Food, level3Food, level4Food};

        for (Node node : foodSpawnLocations) {
            for (Spatial point : node.getChildren()) {
                Vector3f worldTranslation = point.getWorldTranslation();

                Apple apple = (Apple) entityManager.create(Entity.APPLE);
                apple.getSpatial().setLocalTranslation(worldTranslation.add(0, -15f, 0));
                apple.finalise();
                rootNode.attachChild(apple.getSpatial());
                currentLevel.getAllEntities().add(apple);
            }
        }
View Full Code Here

        initialiseEachLevel();
    }

    public void restartLevel() {

        mainCharacter.getCharacterControl().setPhysicsLocation(new Vector3f(-130, 40, -60));

        // cleanup();

        //this calls currentLevel.load() inside
        //  myApp.getStateManager().attach(myApp.getMonkeyAppStateManager().getAppState(LoadingScreenAppState.class));
View Full Code Here

        }

        Matrix3f mat = new Matrix3f();
        mat.fromAngleNormalAxis(rotationSpeed * value, axis);

        Vector3f up = cam.getUp();
        Vector3f left = cam.getLeft();
        Vector3f dir = cam.getDirection();

        mat.mult(up, up);
        mat.mult(left, left);
        mat.mult(dir, dir);

View Full Code Here

        dof.setFocusRange(100);
        fpp.addFilter(dof);
       
        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);
View Full Code Here

    public void setCanZoom(boolean canZoom) {
      this.canZoom = canZoom;
    }
   
  public Ray getClickRay(Vector2f point) {
    Vector3f camLocation = cam.getLocation();
    Vector3f clickPoint = cam.getWorldCoordinates(point, 0.9f);
    Vector3f dir = clickPoint.subtract(camLocation).normalize();
    return new Ray(camLocation, dir);
    //return new Ray(camLocation, cam.getDirection());
  }
View Full Code Here

    /**
     * Update the camera, should only be called internally
     */
    public void updateCamera() {
        float hDistance = distance * FastMath.sin((FastMath.PI / 2) - vRotation);
        Vector3f pos = new Vector3f(hDistance * FastMath.cos(hRotation), distance * FastMath.sin(vRotation), hDistance * FastMath.sin(hRotation));
        pos = pos.add(target.getLocalTranslation());
        cam.setLocation(pos);
        cam.lookAt(target.getLocalTranslation(), initialUpVec);
        cam.setRotation(cam.getRotation().mult(rotaionOffset));
        cam.updateViewProjection();
    }
View Full Code Here

import com.jme3.math.Vector3f;
import com.jme3.math.Spline.SplineType;

public class ShipDemoMotion extends ShipMotionPath {
  public ShipDemoMotion() {
    this.addShipWayPoint(new Vector3f(-1350, 0, 0), 0);
    this.addShipWayPoint(new Vector3f(-500, 0, 0), 0);
    this.addShipWayPoint(new Vector3f(0, -150, 0), 0);
    this.addShipWayPoint(new Vector3f(300, -100, 0), 0);
    this.addShipWayPoint(new Vector3f(500, 300, 0), 0);
    this.addShipWayPoint(new Vector3f(500, 300, 500), 1);
    this.addShipWayPoint(new Vector3f(500, 300, 1500), 0);
    this.addShipWayPoint(new Vector3f(0, 300, 1500), 0.5f);
   


    this.setCurveTension(1f);
   
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.