Examples of Quaternion


Examples of com.ardor3d.math.Quaternion

            final ColladaImporter colladaImporter = new ColladaImporter();

            // Load the collada scene
            final ColladaStorage storage = colladaImporter.load(source);
            colladaNode = storage.getScene();
            colladaNode.setRotation(new Quaternion(-1,0,0,1));
        } catch (final Exception ex) {
            ex.printStackTrace();
        }
    }
View Full Code Here

Examples of com.jme.math.Quaternion

    public void updateGUI() {
        // Fetch the current transform from the movable component
        Cell cell = editor.getCell();
        CellTransform cellTransform = cell.getLocalTransform();
        Vector3f translation = cellTransform.getTranslation(null);
        Quaternion rotation = cellTransform.getRotation(null);
        Vector3f scale = cellTransform.getScaling(null);
        float[] angles = rotation.toAngles(new float[3]);

        // Update the translation spinners
        translationXTF.setValue(translation.x);
        translationYTF.setValue(translation.y);
        translationZTF.setValue(translation.z);
View Full Code Here

Examples of com.jme.math.Quaternion

        // Convert to radians
        x = (float) Math.toRadians(x);
        y = (float) Math.toRadians(y);
        z = (float) Math.toRadians(z);

        Quaternion newRotation = new Quaternion(new float[] { x, y, z });
        if (movableComponent != null) {
            Cell cell = editor.getCell();
            CellTransform cellTransform = cell.getLocalTransform();
            cellTransform.setRotation(newRotation);
            movableComponent.localMoveRequest(cellTransform);
View Full Code Here

Examples of com.jme.math.Quaternion

    @Override
    public Quaternion unmarshal(QuaternionHandler q) throws Exception {
        if (q==null)
            return null;
        Vector3f axis = new Vector3f(q.x, q.y, q.z);
        Quaternion ret = new Quaternion();
        ret.fromAngleAxis(q.angle, axis);
        return ret;
    }
View Full Code Here

Examples of com.jme.math.Quaternion

        String rotZStr = connectionProperties.getProperty(INITIAL_POSITION_PROP_PREFIX + "rotz");
        if (rotZStr != null) {
            rotZ = Float.parseFloat(rotZStr);
        }

        Quaternion rotate = new Quaternion();
        rotate.fromAngles(rotX, rotY, rotZ);

        return new CellTransform(rotate, translation);
    }
View Full Code Here

Examples of com.jme.math.Quaternion

        float startY = Float.parseFloat(System.getProperty("y", "0"));
        float startZ = Float.parseFloat(System.getProperty("z", "0"));
        Vector3f startLoc = new Vector3f(startX, startY, startZ);

        float look = Float.parseFloat(System.getProperty("look""0"));
        Quaternion startLook = new Quaternion(
                new float[] { 0f, (float) Math.toRadians(look), 0f });

        // connect to the default server
        try {
            loadServer(serverURL, startLoc, startLook);
View Full Code Here

Examples of com.jme.math.Quaternion

        float max = 30f;
        float distance = CellPlacementUtils.getDistance(bv, fov, min, max);
       
        // calculate the look vector to this cell -- we only care about the y axis
        // rotation
        Quaternion rotation = cell.getWorldTransform().getRotation(null);
        Vector3f lookVec = CellPlacementUtils.getLookDirection(rotation, null);

        // translate into a quaternion using lookAt
        Quaternion look = new Quaternion();
        look.lookAt(lookVec.negate(), Vector3f.UNIT_Y);

        // find the origin by translating the look vector
        Vector3f origin = lookVec.mult(distance);
        origin.addLocal(cell.getWorldTransform().getTranslation(null));
        return new CellTransform(look, origin);
View Full Code Here

Examples of com.jme.math.Quaternion

     * Returns the camera "look direction" as a vector.
     *
     * @return The camera look direction
     */
    public Vector3f getCameraLookDirection(Vector3f v) {
        Quaternion rot = cameraNode.getWorldRotation();
        if (v == null) {
            v = new Vector3f(0, 0, 1);
        } else {
            v.set(0, 0, 1);
        }
        rot.multLocal(v);
        v.normalizeLocal();
        return v;
    }
View Full Code Here

Examples of com.jme.math.Quaternion

        this.clientID = clientID;

        Vector3f location = new Vector3f(0,0,0);
        Vector3f lookDirection = new Vector3f(0,0,1);

        Quaternion rotation = new Quaternion();
        rotation.lookAt(lookDirection, new Vector3f(0f,1f,0f));
        CellTransform initialLocation = new CellTransform(rotation, location);
        setLocalTransform(initialLocation);
    }
View Full Code Here

Examples of com.jme.math.Quaternion

            float unitMeter = importer.getInstance().getUnitMeter();
            modelNode.setLocalScale(unitMeter);

            String upAxis = importer.getInstance().getUpAxis();
            if ("Z_UP".equals(upAxis)) {
                modelNode.setLocalRotation(new Quaternion(new float[] {-(float)Math.PI/2, 0f, 0f}));
            } else if ("X_UP".equals(upAxis)) {
                modelNode.setLocalRotation(new Quaternion(new float[] {0f, 0f, (float)Math.PI/2}));
            } // Y_UP is the Wonderland default
        }

        importer.cleanUp();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.