collision detection


i’m trying to get collision detection into my pin ball game for the outer edge. i have a ball bouncing round with its vector and position updated in delta t time steps. so far so good

problem is when i get to the edge of my boundary the ball will sometimes bounce off correctly but other times get stuck in the wall and follow the boundary until it reaches the bottom. i’m using a simple ray-line test to see which side of the line the ball is on and if its on the wrong side then calculate the new velocity. i think its because of this time step thing is there anyway better to find a better time and point of collision and if there is what do i then do with it

thanks in advance!

For a simple ball collision detection, you can test it as if it was a simple point against “inflated” geometry.

Poor ascii art begins …
Before :
ball wall
O |-|

After :
ball wall
. |—|

Then, extrude your point between past and present position, it will become a segment. Then it is easy to test a segment against other segments.
The difficulty is to “inflate” properly the geometry : move a radius away along normals for segments, and add a circular joint at segment junctions.

[This message has been edited by ZbuffeR (edited 02-27-2004).]

Show us some code