A Better Way ?
Hi guys,
I''m making a game where the collisions are essentially the same as a breakout/arkanoid game.
Here is how I test a brick (a box in my game):
For each side:
1) test if ball is heading towards it
2) determine where the ball''s center intersects a line that is parallel and exactly the ball''s radius away from the side
3) if the intersection is between the side''s endpoints it hits the side
3) if it''s outside of the endpoints I check the corners by doing a closest distance calculation using the corner as a point and the ball''s starting and ending position as the line segment, if the closest distance is less than the ball''s radius it hits the corner.
It seemed to be working fine but when I have two or more boxes next to each other it can hit the corners in between them ! Which seems impossible because the starting points for the box''s sides are the endpoints of the box next to it so it''s like one big box. Even if it did hit the corner of one box it would hit the side itself of the box next to it sooner so wouldn''t register as a collision.
What am I doing wrong ? Is this a good way to test collisions in a game like breakout/arkanoid ?
Thanks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement