Package com.jme3.math

Examples of com.jme3.math.Quaternion


    spatial = new Geometry(identifier, generateMesh(Vector3f.ZERO, planes, radialSamples, radius, outsideView));
    spatial.setMaterial(world.materialForColor(color));
    spatial.rotate(yaw, pitch, roll);
    spatial.setLocalTranslation(center);
    spatial.setLocalRotation(new Quaternion().fromAngles(pitch, yaw, roll));

    initializePhysics(spatial);
  }
View Full Code Here


    spatial = new Geometry(identifier, new Box(Vector3f.ZERO, size.x / 2.0f, size.y / 2.0f, size.z / 2.0f));
    spatial.setMaterial(world.materialForColor(color));
    spatial.rotate(yaw, pitch, roll);
    spatial.setLocalTranslation(center);
    spatial.setLocalRotation(new Quaternion().fromAngles(pitch, yaw, roll));

    initializePhysics(spatial);
  }
View Full Code Here

  public Ramp(World world, Vector3f base, Vector3f top, float width, float thickness, ColorRGBA color, boolean isHologram) {
    super(0, isHologram, color);

    float length = top.subtract(base).length();
    Quaternion rotation = new Quaternion();
    rotation.lookAt(base.subtract(top), Vector3f.UNIT_Y);

    // These points are an approximation. They should be extended down half
    // the thickness perpendicular to the plane of the ramp.
    Vector3f baseCenter = base.clone().subtractLocal(0.0f, thickness / 2.0f, 0.0f);
    Vector3f topCenter = top.clone().subtractLocal(0.0f, thickness / 2.0f, 0.0f);
View Full Code Here

    leftLegBottom.setMaterial(world.materialForColor(trimColor));
    rightLegBottom.setMaterial(world.materialForColor(trimColor));

    leftLegTop.setLocalTranslation(-.45f, -.45f, -.2f);
    leftLegTop.setLocalRotation(new Quaternion().fromAngles(-(FastMath.PI / 4.4f), 0, 0));

    rightLegTop.setLocalRotation(new Quaternion().fromAngles((FastMath.PI / 4.4f), 0, FastMath.PI));
    rightLegTop.setLocalTranslation(.45f, -.45f, -.2f);

    leftLegBottom.setLocalTranslation(.43f, -1.18f, -.9f);
    leftLegBottom.setLocalRotation(new Quaternion().fromAngles((FastMath.PI / 4.1f), 0, 0));

    rightLegBottom.setLocalTranslation(-.43f, -1.18f, -.9f);
    rightLegBottom.setLocalRotation(new Quaternion().fromAngles(-(FastMath.PI / 4.1f), 0, FastMath.PI));

    hectorNode.attachChild(headNode);
    legsNode.attachChild(leftLegTop);
    legsNode.attachChild(rightLegTop);
    legsNode.attachChild(leftLegBottom);
View Full Code Here

  protected void repositionForCrouching() {
    float a = 4.4f + (crouchFactor * 2.0f);
    float y = -0.45f - (crouchFactor * 0.35f);
    leftLegTop.setLocalTranslation(-.45f, y, -.2f);
    leftLegTop.setLocalRotation(new Quaternion().fromAngles(-(FastMath.PI / a), 0, 0));

    rightLegTop.setLocalRotation(new Quaternion().fromAngles((FastMath.PI / a), 0, FastMath.PI));
    rightLegTop.setLocalTranslation(.45f, y, -.2f);

    a = 4.1f + (crouchFactor * 2.0f);
    y = -1.18f - (crouchFactor * 0.2f);
    leftLegBottom.setLocalTranslation(.43f, y, -.9f);
    leftLegBottom.setLocalRotation(new Quaternion().fromAngles((FastMath.PI / a), 0, 0));

    rightLegBottom.setLocalTranslation(-.43f, y, -.9f);
    rightLegBottom.setLocalRotation(new Quaternion().fromAngles(-(FastMath.PI / a), 0, FastMath.PI));

    y = 0.0f - (crouchFactor * 0.45f);
    headNode.setLocalTranslation(0, y, 0);
  }
View Full Code Here

        sun.setColor(ColorRGBA.White.mult(2f));
        rootNode.addLight(sun);

        cam.setViewPort(0.5f, 1f, 0f, 0.5f);
        cam.setLocation(new Vector3f(-1.3480331f * 1000, 1.098075f * 1000, 1.3006098f * 1000));
        cam.setRotation(new Quaternion(0.107952856f, 0.8841834f, -0.25264242f, 0.37780634f));
        cam.setFrustumFar(5000);
        cam.update();
       
        ViewPort view_1 = renderManager.createMainView("View of camera #n", machine.getCamera());
        view_1.setEnabled(true);
View Full Code Here

    scoutNode.setLocalRotation(scoutMatrix);
    hector.getLegsNode().attachChild(scoutNode);

    player.setPhysicsLocation(incarn.getLocation());

    headRot = new Quaternion();
    setupKeys(input);
  }
View Full Code Here

    }

    if (!crouching)
      hector.uncrouch(tpf);

    hector.getLegsNode().setLocalRotation(new Quaternion().fromRotationMatrix(bodyRot).mult(new Quaternion().fromAngles(0, FastMath.PI, 0)));

    headRot.fromAngles(-headAngleY * FastMath.DEG_TO_RAD, FastMath.PI + ((walkAngle + headAngleX) * FastMath.DEG_TO_RAD), 0.0f);
    hector.getHeadNode().setLocalRotation(headRot);
   
    listener.setLocation(camNode.getCamera().getLocation());
View Full Code Here

    zLabel.setLocalTranslation(cam.getScreenCoordinates(zPoint));

    if (!crouching)
      hector.uncrouch(tpf);

    Quaternion rot = new Quaternion();
    rot.fromAngles(-headAngleY * FastMath.DEG_TO_RAD, -headAngleX * FastMath.DEG_TO_RAD, 0);
    headNode.setLocalRotation(rot);
  }
View Full Code Here

    @Override
    public void simpleInitApp() {
        //clears the debbuging messages
        guiNode.detachAllChildren();

        Quaternion vncYAW090   = new Quaternion().fromAngleAxis((7*FastMath.PI)/12,   new Vector3f(0,1,0));
        vncImagingSystem = new ImagingSystem(this, 140f,800,600);
        rootNode.attachChild(vncImagingSystem.getScreen());
        vncImagingSystem.getScreen().setLocalTranslation(-255f, -10f, 115f);
        vncImagingSystem.getScreen().setLocalRotation(vncYAW090);
       
       
       
        webcamImagingSystem = new ImagingSystem(this, 140f, 800, 600);
        rootNode.attachChild(webcamImagingSystem.getScreen());
       // (-117.84772, -3.4392495, -5.936719)
        webcamImagingSystem.getScreen().setLocalTranslation(-295f, -10f, -30f);
         Quaternion YAW090   = new Quaternion().fromAngleAxis((5*FastMath.PI)/12,   new Vector3f(0,1,0));
        webcamImagingSystem.getScreen().setLocalRotation(YAW090);

        //ImagingSystem benkyouBanner = new ImagingSystem(this, 40f, 640, 480);
        //rootNode.attachChild(benkyouBanner.getScreen());
        //benkyouBanner.getScreen().setLocalTranslation(-30f, 10f, -80);
View Full Code Here

TOP

Related Classes of com.jme3.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.