Collision with rounded corners
Adrenaline
Member Posts: 523
I have a rectangular space that some balls are bouncing around in. To set up the collision rules without having the balls slow in any way, I've set up rules for each wall. For example, when a ball collides with a left or right wall, it reverses its x velocity. Top or bottom wall reverses its y velocity.
My question is this: how would I tackle the problem of rounding the corners inward of the rectangular space? So imagine a circle is wedged into each corner, and I want the bouncing balls to collide and bounce off of these circles in a realistic way without losing any speed.
I'm open to any way of solving this issue, even if it means I should change the way the balls act on the regular walls as well.
Thanks all!
My question is this: how would I tackle the problem of rounding the corners inward of the rectangular space? So imagine a circle is wedged into each corner, and I want the bouncing balls to collide and bounce off of these circles in a realistic way without losing any speed.
I'm open to any way of solving this issue, even if it means I should change the way the balls act on the regular walls as well.
Thanks all!
Comments
Question though: Are there going to be physical circles in the corner you want them bouncing off of? Basically, it would help if you can give a little more detail, or even a screen shot.
I'm not on my working computer right now, so I can't send a screenshot until later...but I think you have the right idea --- A standard rectangle, with circles (like hills) in the corners.
This means there are no 90-degree angles in the space anymore. Like this incredibly crude 'sketch' below.
EDIT: this wasn't rendered correctly before, so I added _ to fill the space. In reality, the rectangle is empty
_____________
O___________O
|_____________|
|_____________|
|_____________|
O___________O