Package com.jme.math

Examples of com.jme.math.Quaternion


     *
     * @param viewTransform The transform of the viewer
     * @return A rotation in world coordinates
     */
    public static Quaternion getCellRotation(CellTransform viewTransform) {
        Quaternion viewRotation = viewTransform.getRotation(null);
        Vector3f lookAt = CellPlacementUtils.getLookDirection(viewRotation, null);
        Quaternion rotation = new Quaternion();
        rotation.lookAt(lookAt.negate(), new Vector3f(0, 1, 0));
        return rotation;
    }
View Full Code Here


        startingLocationMI = new JMenuItem(BUNDLE.getString("Starting_Location"));
        startingLocationMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
               
                Vector3f position = new Vector3f();
                Quaternion look = new Quaternion();

                String prop = System.getProperty("Placemark.CoverScreen");
                if(prop == null) {
                    prop="";
                }
View Full Code Here

        // Find out what the URL to the server is
        String url = sessionManager.getServerURL();

        // Compute the current look angle, as degrees from the +x axis, ignoring
        // any look in the y-axis.
        Quaternion viewRotation = viewTransform.getRotation(null);

        Vector3f v1 = new Vector3f(0, 0, 1);
        Vector3f normal = new Vector3f(0, 1, 0);
        Vector3f v2 = viewRotation.mult(v1);
        v2.normalizeLocal();

        // Compute the signed angle between v1 and v2. We do this with the
        // following formula: angle = atan2(normal dot (v1 cross v2), v1 dot v2)
        float dotProduct = v1.dot(v2);
View Full Code Here

 
  public TeapotSynchronizeCreateMessage() {
    super();
    System.out.println("Creating TeapotSyncCreateMessage");
    this.translation = new Vector3f();
    this.rotation = new Quaternion();
  }
View Full Code Here

  public PhysicsFireableSynchronizeCreateMessage() {
    super();
    System.out.println("Creating FireableSyncCreateMessage");
    this.translation = new Vector3f();
    this.rotation = new Quaternion();
  }
View Full Code Here

    super();
    System.out.println("Creating FireableSyncCreateMessage");
    warhead = pFire.getWarhead();
   
    this.translation = new Vector3f();
    this.rotation = new Quaternion();
   
    stabilizationForce = pFire.getStabilizationForce();
    stabilizationSpeed = pFire.getStabilizationSpeed();
    linearDragCoefficient = pFire.getLinearDragCoefficient();
    linearDragArea = pFire.getLinearDragArea();
View Full Code Here

    System.out.println("Creating FireableSyncCreateMessage");
    this.fireableClass = fireableClass;
    warhead = pFire.getWarhead();
   
    this.translation = new Vector3f();
    this.rotation = new Quaternion();
   
    stabilizationForce = pFire.getStabilizationForce();
    stabilizationSpeed = pFire.getStabilizationSpeed();
    linearDragCoefficient = pFire.getLinearDragCoefficient();
    linearDragArea = pFire.getLinearDragArea();
View Full Code Here

    public VirtualHandler(Camera cam, ControlCrossNode ccn, SpeedBarNode sbn) {
        this.cam = cam;
        this.ccn = ccn;
        this.sbn = sbn;
        quaternion = new Quaternion().fromAxes(cam.getLeft(), cam.getUp(), cam.getDirection());
    }
View Full Code Here

        for (int x = 0; x < size; x++) {
            for (int z = 0; z < size; z++) {
                orand = rand.nextFloat() - .5f;
                for (int i = 0; i < turnNumber; i++) {
                    frand = (rand.nextFloat() * 0.50f) + 0.50f;
                    GeometryBatchInstance instance = new GeometryBatchInstance(q, new GeometryBatchInstanceAttributes(instanceTranslation.set((x * VegetationManager.VEGETATION_STEP) + orand, scale / 2, (z * VegetationManager.VEGETATION_STEP) + orand), new Vector3f(scale * frand, scale * frand, scale * frand), new Quaternion().fromAngleAxis((float) ((Math.PI * 2) / turnNumber) * i, Vector3f.UNIT_Y), new ColorRGBA(INSTANCE_COLOR.r + (rand.nextFloat() / 10f), INSTANCE_COLOR.g + (rand.nextFloat() / 8f), INSTANCE_COLOR.b + (rand.nextFloat() / 8f), INSTANCE_COLOR.a)));

                    creator.addInstance(instance);
                }
            }
        }
View Full Code Here

            this.freeroaming = freeroaming;
        }

        public void tiltCamera(float radDegree) {
            if (react) {
                Quaternion tilt = new Quaternion();
                Quaternion pan = new Quaternion();

                yrot = yrot + radDegree;
                if (yrot > FastMath.TWO_PI * 2 || yrot < FastMath.TWO_PI * -2) {
                    yrot = 0 + radDegree;
                }

                tilt = tilt.fromAngleAxis(yrot,left);

                pan = pan.fromAngleAxis(xrot, Vector3f.UNIT_Z);
                pan.multLocal(tilt);
                camerapivot.setLocalRotation(pan);
                cameraOrbit.update();
            }
        }
View Full Code Here

TOP

Related Classes of com.jme.math.Quaternion

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.