コード例 #1
0
  public void calculateNextCollisionPoint(Hitbox other, float time) {
    if (!testCollision(other, time)) {
      return;
    }

    CollisionPoint cp = getCurrentCollisionPoint(other, time);

    // détection des collisions infinies
    if (this.lastCollision >= cp.getTime() && this.lastHitboxes.contains(other)) {
      return;
    }

    Hitbox[] both = new Hitbox[] {this, other};

    for (Hitbox hb : both) {
      if (hb.nextCollisionPoint != null) hb.nextCollisionPoint.delete();
      hb.nextCollisionPoint = cp;
    }
  }