Package com.jme.math

Examples of com.jme.math.Quaternion


     * @param translate
     * @param scale
     */
    public CellTransform(Quaternion rotate, Vector3f translate, Vector3f scale) {
        if (rotate==null)
            this.rotation = new Quaternion();
        else
            this.rotation = rotate.clone();

        if (translate==null)
            this.translation = new Vector3f();
View Full Code Here


        this(rotate, translation, 1f);

    }

    private CellTransform(CellTransform orig) {
        this.rotation = new Quaternion(orig.rotation);
        this.translation = new Vector3f(orig.translation);
        this.scale = orig.scale;
    }
View Full Code Here

     * @param rotation object to return (to avoid gc)
     * @return the rotation quaternion for this transform
     */
    public Quaternion getRotation(Quaternion rotation) {
        if (rotation==null)
            rotation = new Quaternion(this.rotation);
        else
            rotation.set(this.rotation);
       
        return rotation;
    }
View Full Code Here

     * Set the rotation portion of this transform
     * @param rotation set the rotation for this transform
     */
    public void setRotation(Quaternion rotation) {
        if (this.rotation==null)
            this.rotation = new Quaternion(rotation);
        else
            this.rotation.set(rotation);
    }
View Full Code Here

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

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

        importer.cleanUp();

        setupBounds(modelNode);
View Full Code Here

        message = state.getMessage();
       
        // Fetc the destination look direction from the server state. If the
        // value is null, then set the original value and text field to an
        // empty string.
        Quaternion lookAt = state.getLook();
        if (lookAt != null) {
            float lookDirection = (float) Math.toDegrees(lookAt.toAngleAxis(new Vector3f()));
            origLookDirection = lookDirection;
        } else {
            origLookDirection = 0;
        }
View Full Code Here

        // Set the location on the server state
        state.setLocation(new Vector3f(origX, origY, origZ));

        // Set the destination look direction from the text field. If the text
        // field is empty, then set the server state as a zero rotation.
        Quaternion look = new Quaternion();
        Vector3f axis = new Vector3f(0.0f, 1.0f, 0.0f);
        float angle = (float) Math.toRadians(origLookDirection);
  look.fromAngleAxis((float) angle, axis);
        state.setLook(look);

  state.setAudioSourceType(origAudioSourceType);
  state.setAudioSource(origAudioSource);
  state.setUploadFile(true);
View Full Code Here

     * this node
     * @param node
     */
    private void setSpinners(Node modelBG, Node rootBG) {
        Vector3f translation = rootBG.getLocalTranslation();
        Quaternion quat = modelBG.getLocalRotation();
        float[] angles = quat.toAngles(new float[3]);
        Vector3f scale = modelBG.getLocalScale();

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

     */
    public static CellTransform getCellTransform(ServerSessionManager session,
            BoundingVolume bounds, CellTransform viewTransform) {

        Vector3f origin = getCellOrigin(session, bounds, viewTransform);
        Quaternion rotation = getCellRotation(viewTransform);
        return new CellTransform(rotation, origin);
    }
View Full Code Here

        }

        // Fetch a whole bunch of things about the view cell: its transform,
        // position, rotation, and "look at" vector.
        Vector3f viewPosition = viewTransform.getTranslation(null);
        Quaternion viewRotation = viewTransform.getRotation(null);
        Vector3f lookAt = CellPlacementUtils.getLookDirection(viewRotation, null);

        logger.info("Using position of view cell " + viewPosition);
        logger.info("Using look-at vector of view cell " + lookAt);
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.