public void setEarParameters() {
    Matrix3D avDir = (Matrix3D) (player1.getWorldRotation().clone());
    float camAz;

    if (!isGPOn) {
      camAz = cam1Controller.getAzimuth();
    } else {
      camAz = cam1GPController.getAzimuth();
    }

    avDir.rotateY(180.0f - camAz);
    Vector3D camDir = new Vector3D(0, 0, 1);
    camDir = camDir.mult(avDir);
    audioMgr.getEar().setLocation(camera1.getLocation());
    audioMgr.getEar().setOrientation(camDir, new Vector3D(0, 1, 0));
  }
Пример #2
0
 public void performAction(float time, Event e) {
   /* sM.translate(0,0,0.1f);
   s.setLocalTranslation(sM);
   s.updateWorldBound();
   */
   Matrix3D rot = s.getLocalRotation();
   Vector3D dir = new Vector3D(0, -1, 1);
   dir = dir.mult(rot);
   dir.scale((double) (speed * time));
   s.translate((float) dir.getX(), (float) dir.getY(), (float) dir.getZ());
   s.updateWorldBound();
 }
Пример #3
0
  @Override
  public void update(long time) {
    double[] angleAxis = rotation.getAngleAxis();
    Matrix3D mat =
        new Matrix3D(angleAxis[0], new Vector3D(angleAxis[1], angleAxis[2], angleAxis[3]));

    if (forwardMotion != 0) {
      double distance = time * SPEED * forwardMotion;
      Vector3D forward = mat.getRow(2);
      forward.scale(distance);
      location = location.add(forward);
    }

    if (strafeMotion != 0) {
      double distance = time * SPEED * strafeMotion;
      Vector3D strafe = mat.getRow(0);
      strafe.scale(distance);
      location = location.add(strafe);
    }
  }
  public float[] getNormals(float[] input) {
    Vector<Float> result = new Vector<Float>();
    for (int i = 0; i < input.length; i += 9) {
      Point3D a = new Point3D(input[i], input[i + 1], input[i + 2]);
      Point3D b = new Point3D(input[i + 3], input[i + 4], input[i + 5]);
      Point3D c = new Point3D(input[i + 6], input[i + 7], input[i + 8]);
      Point3D p1 = b.minus(a);
      Point3D p2 = c.minus(a);

      Vector3D e1 = new Vector3D(p1);
      Vector3D e2 = new Vector3D(p2);
      Vector3D n = e1.cross(e2).normalize();
      for (int j = 0; j < 3; j++) {
        result.add(-(float) n.getX());
        // System.out.print(n.getX());
        result.add(-(float) n.getY());
        // System.out.print(n.getY());
        result.add(-(float) n.getZ());
        // System.out.print(n.getZ());
        // System.out.println();
      }
    }
    return ArrayUtils.toPrimitive(result.toArray(new Float[0]));
  }
 public void initPlayerLocation(Vector3D loc) {
   player1.translate((float) loc.getX(), (float) loc.getY(), (float) loc.getZ());
   //		player1.translate(133f, 13f, 123f);
 }
Пример #6
0
 @Override
 public Point3D getLocation() {
   return new Point3D(location.getX(), location.getY(), location.getZ());
 }