Drag
Member
Now, I usually don't have a lot of problems with collision detection, but I'm having trouble with it now.
I can't figure out the best way to get it working! I'm talking about physics like balls bumping into each other and stuff.
I can't figure out how to tell which edge is bumping into an object.
When a ball falls onto a wall, for example, three sides are detected entering the wall: the bottom edge, the left edge, and the right edge.
So the way I'm doing it now, the ball would bounce, but it'd also stop, as though it bumped into a wall on both edges.
If the ball moved right and bumped into a wall, the bottom, top, and right edge would all detect a collision, so the ball would bounce off of the wall, and bounce upward, as though it hit the floor.
So I need a way to detect which specific edge(s) is/are actually passing into the wall.
When the ball is moving down and right, when it hits the floor, I want it to detect that as a collision with the bottom edge of the ball, as opposed to a collision with the bottom, right, and left edge.
Can anyone help? I'm not very experienced in video game physics.
This is for my Incredible Machine clone, by the way.
I can't figure out the best way to get it working! I'm talking about physics like balls bumping into each other and stuff.
I can't figure out how to tell which edge is bumping into an object.
When a ball falls onto a wall, for example, three sides are detected entering the wall: the bottom edge, the left edge, and the right edge.
So the way I'm doing it now, the ball would bounce, but it'd also stop, as though it bumped into a wall on both edges.
If the ball moved right and bumped into a wall, the bottom, top, and right edge would all detect a collision, so the ball would bounce off of the wall, and bounce upward, as though it hit the floor.
So I need a way to detect which specific edge(s) is/are actually passing into the wall.
When the ball is moving down and right, when it hits the floor, I want it to detect that as a collision with the bottom edge of the ball, as opposed to a collision with the bottom, right, and left edge.
Can anyone help? I'm not very experienced in video game physics.
This is for my Incredible Machine clone, by the way.