123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|291|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> circle collision detection?

Fri, 01 Jun 2007, 02:56
spinal
This is the first time I've thought about using anything other that regular box detection, but I'm attempting to move a ball around the screen using analogue(ish) input and having it hit off things. but so fat I'm only checking the x and y collisions separately, eg if x<0 then x=0:xmotion=-xmotion. But I want something a little more useful, at the moment the ball can easily get 'spiked' on the corner of a block or something, which doesn't look too good when your rolling this ball around. can someone give me a clue how to do this?

Thanks

-=-=-
Check out my excellent homepage!
Fri, 01 Jun 2007, 03:02
mike_g
if you get the distance from the centre of the circle then you can check for collisions by looking if anything is inside its radius. Heres a get distance function (sorry its in C, but the maths is the same)

Fri, 01 Jun 2007, 03:17
JL235
There was a topic on this already, and I'm pretty sure my code allows for this. Like Mike_G's suggestion above, It does this through finding the distance from the centre of the circle.

|edit| Here is the link to the other topic. |edit|