4

I'm making a game where the player is an upright capped cylinder, and the world is axis aligned bounding boxes. Given this, how could I check if the cylinder is intersecting a box?

Thanks

Nico
  • 2,645
  • 19
  • 25
jmasterx
  • 52,639
  • 96
  • 311
  • 557
  • Previously: [Collision detection between 2 rotated cubes](http://stackoverflow.com/questions/3651613/), [Collision detection between two general hexahedrons](http://stackoverflow.com/questions/3648285/) and an earlier version now deleted. – dmckee --- ex-moderator kitten Sep 06 '10 at 17:11

1 Answers1

3

It's mostly a 2D problem.

For each AABB, test that the vertical dimensions of the cylinder overlap the vertical dimensions of the AABB. If so, then the test reduces to a 2D case, otherwise, there's no collision.

Then, in the 2D case you need to find if your circle intersects a rectangle... and I'll just refer you to here:

Circle-Rectangle collision detection (intersection)

Community
  • 1
  • 1
Detmar
  • 713
  • 4
  • 6