Collision with rounded corners

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!

Comments

  • ShmirlyWhirlShmirlyWhirl Member Posts: 189
    Right off the bat it sounds like you're going to need more general math for the collisions to work properly.

    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.
  • AdrenalineAdrenaline Member Posts: 523
    edited February 2013
    I have it working perfectly without the circles in the corners. I'm sure you're right, I will need more math to make it work with the circles in the corners, though.

    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
  • AdrenalineAdrenaline Member Posts: 523
    I've decided that the standard collision behavior will do just fine for my game. This no longer needs attention. Unless anyone else is interested in continuing the discussion...
Sign In or Register to comment.