Collision detection question

Hi everyone,

I wonder if you could help me on this problem.
I’m doing a sort of Lander game. The ship moves around in caves.
I need a precise collision detection, as the side of the caves are “complexe”

I would like to generate automatically the collision vectors from the bitmap image.
I was thinking that I could

  • Change the image to 2 colors
  • Vectorise the new picture somehow
  • Simplify the result somehow (less vectors)
  • read the vectors

Here is a visual explanation

Is there a way of doing this programatically ?
Or do I need to define all my vectors manualy

Thanks for your help

Looks like what you want to do is pixel perfect collision detection, another method is as you described, which is create a complex triangulated mesh, but that seems way too complex for this.

Pixel perfect collision would be best for this scenario. The most efficient way to do it would be to do a circle-v-circle or rect-v-rect before checking the pixels.

Hi,

Thank you for your answers.

I cannot have pixel collisions as I’d like (in the future) to have the angle of the collision vector so the object colliding can bounce back.

I’ve found this freeware tool to outline manually my collision bitmap

http://www.underwaredesign.com/forums/index.php?topic=2939.0

Use marching squares to generate a list of points (the outline) then simplify the poly-line using the Ramer-Douglas-Peucker algorithm.

Thanks alot, it’s exactly what I was looking for.