API Reference › Collision › Collision.circles
method

Collision.circles

Collision.circles(ax, ay, ar, bx, by, br) -> bool

Returns true when circles centred at (ax, ay) and (bx, by) with radii ar and br overlap — that is, when the distance between centres is at most ar + br. It compares squared distances internally, so there is no square root and no precision loss.

Example

program Demo {
  handler Step phase Update {
    if Collision.circles(px, py, 8, ex, ey, 8) { collide() }
  }
}
← All symbols