# Bouncing Off Corners ??

## Recommended Posts

Hi. I was wondering if anyone could tell me how a sphere should respond when it hits against a corner. What direction should it bounce in and how do you determine it? I'm sure there's loads of great articles about this but i cant seem to find any - if you could point me to one or if you know the answer yourself that would be great.

__ -->
/  \    ________________
\__/    \
\


My collision detection at the moment uses the planes normal to determine the bounce, it bounces at the same angle at it comes in at, but i dont know what to do here. Any help would be great. Tx

##### Share on other sites
Here's one way to do it. If the ball hits a corner, you need to find an appropriate plane to bounce off of. The normal of this plane is the normalized vector from the corner (the point of intersection) to the center of the circle. The intersection point is also your reference point for the plane.

##### Share on other sites
Using your existing model (collision acting normal to the shared contact plane) seems reasonable, but the plane calculation's accuracy would be paramount.

Strictly speaking, a corner collision is no different to any other wall collision because the contact area is always going to be theoretically approaching 0 anyway (for spheres).

##### Share on other sites
Do nothing special?

seriously.

bouncing off of a corner as is easy as bouncing off of each of the three walls that make up the corner. Same as you would bounce off of jsut a wall.

Now, if you're moving in large steps that make your ball cross two or more walls at the same time, you could either do liek suggested and come up with a normal that represents the collision with jsut one wall (somehow!), or you could "jump back" in time enough to the point where it only intersected with one wall, bounce it, then fast forward back to the right point in time.

that could play hell with having lots of balls bounce back and forth, though.

Maybe jsut run the physics serveral times in small increments per frame, so the chance of hitting two walls at once goes way down.

Of course, smebody will probably come back with that (somehow!), and make me looklike a simpleton.

##### Share on other sites
Quote:
 Original post by C-Junkiebouncing off of a corner as is easy as bouncing off of each of the three walls that make up the corner.

That would only work off an internal corner, like throwing a ball up to the corner of a room. I think he wants it like throwing a ball at the corner of a table.

##### Share on other sites
Yea - its the corner of the table type scenario i'm after - in real life its quite unpredictable if you whack a ball at the corner of a wall - even if you have good aim. I was thinking about that "finding the appropriate plane to bounce off" idea myself but i wouldn't know how to calculate it - i say you'd need the normal from the centre of the ball to the collision point, the normals defining the corner and the velocity normal but i dont know how to use them in an equation to find the appropriate planenormal that i would be bouncing off.

Thanx for all the replies.
[help]

##### Share on other sites
Just take Normal(CenterOfBall - CornerOfTable). That's the normal of the plane to bounce off of. Use that to do your normal bounce calculations.

##### Share on other sites
Thanx for all the replies, i missed jyks post - he had the answer and so did nagromo.

[Edited by - Cuchulainn on July 8, 2004 3:27:44 PM]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628333
• Total Posts
2982130

• 24
• 9
• 9
• 13
• 11