CollisionDetection icon indicating copy to clipboard operation
CollisionDetection copied to clipboard

Collision of rounded rectangle and circle

Open DJ-HeYong opened this issue 4 years ago • 2 comments
trafficstars

Collision of rounded rectangle and circle , Excuse me, is there a solution ?

DJ-HeYong avatar Oct 28 '21 06:10 DJ-HeYong

Hmm that would be really tricky. You could divide the collision into several steps:

  • Four circle/circle tests, one for each corner of the rectangle
  • Two circle/rect tests, one for the vertical rectangle made when you remove the rounded corners, then one for the horizontal one

But, unless you really need the perfect accuracy, I think simplifying the rounded rectangle to a regular one (just for collision) would be the better way to go. Hope that helps!

jeffThompson avatar Nov 03 '21 15:11 jeffThompson

Oh, that's it, thank you very much.

DJ-HeYong avatar Nov 05 '21 10:11 DJ-HeYong