Computer Science Canada

Question on collision detection

Author:  dehu87 [ Sat Jun 07, 2008 9:51 am ]
Post subject:  Question on collision detection

I have a game where the user controls a spaceship (picture) and if any asteroids hit the spaceship than there is a collision. My question is what type of collision detection method should I use for a pic and an oval?

Author:  Insectoid [ Sun Jun 08, 2008 9:30 am ]
Post subject:  RE:Question on collision detection

Use oval collision, here.

Author:  dehu87 [ Sun Jun 08, 2008 1:57 pm ]
Post subject:  Re: Question on collision detection

but does this work for a rectangular picture Question

Author:  Tony [ Sun Jun 08, 2008 2:11 pm ]
Post subject:  RE:Question on collision detection

Yes. "How well" depends on how closely your circle of choice approximates the rectangular picture.

I'm assuming that circles should work alright for images of spaceships though. Definitely easier on the math Wink

Author:  dehu87 [ Sun Jun 08, 2008 5:59 pm ]
Post subject:  Re: RE:Question on collision detection

Tony @ Sun Jun 08, 2008 2:11 pm wrote:
Yes. "How well" depends on how closely your circle of choice approximates the rectangular picture.

I'm assuming that circles should work alright for images of spaceships though. Definitely easier on the math Wink


Sorry but I don't quite get this. How do you make a circle into a recangular picture? Embarassed

Author:  Tony [ Sun Jun 08, 2008 6:09 pm ]
Post subject:  RE:Question on collision detection

You align the circle's center with the rectangle's center, and then make the circle's radius large enough to cover most of the rectangle.

It might help if you draw this out on paper first.

Author:  jeffgreco13 [ Mon Jun 09, 2008 9:29 am ]
Post subject:  Re: Question on collision detection

If you want use rectangular collision detection if your spaceship is closer to a rectangular shape. But there are more values to taek into account such as the height and width which must be added to the x and y coords to simluate the ship.

Think about it, circular is probably the easiest, but if your ship is rectangualr then the above collision detection would be most accurate.

Author:  dehu87 [ Mon Jun 09, 2008 10:42 pm ]
Post subject:  Re: RE:Question on collision detection

Tony @ Sun Jun 08, 2008 6:09 pm wrote:

It might help if you draw this out on paper first.


Ya it's true that drawing it on paper first is useful. Thats a good tip, thx.


: