Ejemplo n.º 1
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);
    }
  }
Ejemplo n.º 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();
 }