CuteAlien wrote:This is about 2D?
Yes this is about 2d, as the topic states
CuteAlien wrote:Maybe it helps if you think of the box as 4 lines so you can do line-circle collisions and then take the "best" of those (whatever best means for you)
well I've already tried tons of ideas, but neither of them worked good enough to be used.
fmx wrote:Hang on a minute, what exactly do you want to use the "contact normal" for?
Well it's going to be used in some "physics" calculations, but I wouldn't really call them so.
fmx wrote:You can get a general direction vector from box-to-circle (using their centers) and use the normalized value after you determine they collide...
That works when the circle hit's the box at the center points of the lines or edges at the same spots, otherwise it returns some pretty weird results.
fmx wrote:but that will never get you the true Surface "contact normal" on the box because of one simple reason:
when a circle intersects with anything, it always has 2 intersection points!
As long as I could get a close to real contact normal I'd be happy

fmx wrote:if you want the exact point of collision when the circle edge touched the box edge, you would need to extrapolate the circle's position backwards (after you determine collision has occured), until only a single point on the circle touches a boxes edge, then the surface "contact normal" would be exactly what you need
Can't quite wrap my head around this one. Wouldn't one contact point only return a perpendicular normal to one of the four surfaces ? (remember I need proper edge normals).
fmx wrote:Maybe you should use a proper physics engine, something like box2d
http://box2d.org/
For what I need it is totally an overkill. And I've already given it a try

I've had some more Ideas now, will try to see if either of them works.