Exemple #1
0
  public void toAt(Vector cam, Vector obj) {
    if (cam == null || obj == null) throw new NullPointerException();

    dir.set(0, 0, 0);
    dir.set(obj);
    dir.sub(cam);
    dir.mult(-1f);
    dir.norm();
    dir.get(dirArray);

    right.set(0, 0, 0);
    right.cross(worldUp, dir);
    right.norm();
    right.get(rightArray);

    up.set(0, 0, 0);
    up.cross(dir, right);
    up.norm();
    up.get(upArray);

    set(
        rightArray[0],
        rightArray[1],
        rightArray[2],
        upArray[0],
        upArray[1],
        upArray[2],
        dirArray[0],
        dirArray[1],
        dirArray[2]);
  }
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    int x = (int) event.getX();
    int y = (int) event.getY();
    int[] colors = new int[] {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW};
    // color = colors[new Random().nextInt(colors.length)];
    // radius = new Random().nextInt(30) + 50;

    // 引力
    Vector touch = new Vector(x, y);
    acc = Vector.sub(touch, loca);
    acc.normalize();
    acc.mult(15.0f);

    return super.onTouchEvent(event);
  }
Exemple #3
0
 // TODO NEW
 public Vector getMeanY() {
   final Vector result = this.ySum.copy();
   result.mult(1.0 / this.n);
   return result;
 }
 public void setAccel(Vector accel) {
   acceleration = accel.get();
   acceleration.mult(damping);
 }
 public void applyForce(Vector force) {
   Vector f = force.get();
   f.mult(mass);
   f.mult(damping);
   acceleration.add(f);
 }
Exemple #6
0
 public void recoilExp(Vector A) {
   recoilVel = A.mult(recC);
   State = 3;
   timeRecoil = 0;
 }