예제 #1
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();
 }
  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);
 }
예제 #4
0
 @Override
 public Point3D getLocation() {
   return new Point3D(location.getX(), location.getY(), location.getZ());
 }