Skip to content

Instantly share code, notes, and snippets.

@kistaaa
Created April 14, 2024 16:19
Show Gist options
  • Save kistaaa/eb367088822adb387619a955874675aa to your computer and use it in GitHub Desktop.
Save kistaaa/eb367088822adb387619a955874675aa to your computer and use it in GitHub Desktop.
Circle Colision in JS
const checkCollision = (p1x, p1y, r1, p2x, p2y, r2) => ((r1 + r2) ** 2 > (p1x - p2x) ** 2 + (p1y - p2y) ** 2)
var collision = checkCollision(5, 500, 10, 1000, 1500, 1500);
console.log(collision);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment