Sign in to follow this  
Cuchulainn

Bouncing Off Corners ??

Recommended Posts

Cuchulainn    132
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 this post


Link to post
Share on other sites
jyk    2094
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 this post


Link to post
Share on other sites
Chris Hare    462
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 this post


Link to post
Share on other sites
C-Junkie    1099
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 this post


Link to post
Share on other sites
teamonkey    200
Quote:
Original post by C-Junkie
bouncing 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 this post


Link to post
Share on other sites
Cuchulainn    132
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 this post


Link to post
Share on other sites
nagromo    676
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 this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this