Package edu.cmu.cs.stage3.math

Examples of edu.cmu.cs.stage3.math.Quaternion


  {

  @Override
  public AIResult Execute(AbstractControlledObject<?, ?> obj, AIContext ctx, float gameTime)
    {
    Quaternion rotation = obj.dataObject.getRotation();
    if(rotation == null)
      rotation = new Quaternion();
   
    //TODO: use angular velocity
    float rot = 0.01f * gameTime;
    obj.dataObject.setRotation(rotation.mult(new Quaternion(rot, rot, rot, 1)));

    return AIResult.Success;
    }
View Full Code Here


   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRotation(Quaternion newRotation) {
    Quaternion oldRotation = rotation;
    rotation = newRotation;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BasePackage.ABSTRACT_NAMED_ENTITY__ROTATION, oldRotation, rotation));
  }
View Full Code Here

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAngularVelocity(Quaternion newAngularVelocity) {
    Quaternion oldAngularVelocity = angularVelocity;
    angularVelocity = newAngularVelocity;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, BasePackage.ABSTRACT_NAMED_ENTITY__ANGULAR_VELOCITY, oldAngularVelocity, angularVelocity));
  }
View Full Code Here

        guiNode.setCullHint(CullHint.Never);
        viewPort.attachScene(rootNode);
        guiViewPort.attachScene(guiNode);
        createAxis();
       
        cam.setRotation(new Quaternion(0,1,0,0));

        if (inputManager != null) {
            flyCam = new FlyByCamera(cam);
            flyCam.registerWithInput(inputManager);
View Full Code Here

            if (name.equals("SIMPLEAPP_Exit")) {
                stop();
            } else if (name.equals("SIMPLEAPP_CameraPos")) {
                if (cam != null) {
                    Vector3f loc = cam.getLocation();
                    Quaternion rot = cam.getRotation();
                    System.out.println("Camera Position: ("
                            + loc.x + ", " + loc.y + ", " + loc.z + ")");
                    System.out.println("Camera Rotation: " + rot);
                    System.out.println("Camera Direction: " + cam.getDirection());
                }
            } else if (name.equals("SIMPLEAPP_Memory")) {
                BufferUtils.printCurrentDirectMemory(null);
            }
           
            else if (name.equals("SIMPLEAPP_ResetPos")) {
                cam.setRotation(new Quaternion(0,1,0,0));
                cam.setLocation(new Vector3f(3, 3, 3));
                cam.lookAt(new Vector3f(0,0,0), new Vector3f(0,0,1));
            }
        }
View Full Code Here

  }

  public void rotateEpsilon(float epsilon) {

    Quaternion quat = new Quaternion();
    // seems silly to make this over and over.
    quat.fromAngleAxis(epsilon, Vector3f.UNIT_Y);
    quat.mult(viewDirection, viewDirection);
    player.setViewDirection(viewDirection);
  }
View Full Code Here

     * applies the current transform to the given jme Node if the location has been updated on the physics side
     * @param spatial
     */
    public boolean applyTransform(Spatial spatial) {
        Vector3f localLocation = spatial.getLocalTranslation();
        Quaternion localRotationQuat = spatial.getLocalRotation();
        boolean physicsLocationDirty = applyTransform(motionStateId, localLocation, localRotationQuat);
        if (!physicsLocationDirty) {
            return false;
        }
        if (!applyPhysicsLocal && spatial.getParent() != null) {
View Full Code Here

    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

TOP

Related Classes of edu.cmu.cs.stage3.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.