# Bouncing balls

This topic is 3269 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Can somebody provide me some good articles on that would help me get started with how bouncy balls would react when bouncing off each other or a wall. I know how to get them bouncing up and down in different directions and how to detect collision between them, but I'm unsure on how they change direction afterwards. For example if I hit a wall, I would guess I could use dot product with the plane normal to somehow change it's direction but I'm not sure; If it hits a wall while being throw up would it's new direction be an exact reflection at the normal? Furthermore I don't know how one ball hitting another might alter both velocities. thanks for any links.

##### Share on other sites
The following thread may be of interest to you, I have been trying to get someone to review it for a few days now.

http://www.gamedev.net/community/forums/topic.asp?topic_id=554643

##### Share on other sites
it appears I was overthinking this - if I have sphere intersect with a plane all I needed to do would reflect the direction velocity vector at the surface normal, then divide velocity by an offset that alters depending on what direction you hit; the same concept as when you hit the floor and bounce you invert the y velocity and weaken it. probably a cheap hack, but you can't tell when looking.

##### Share on other sites
Yea you could just invert the y or the x depending on the position hit.
But I would also still like to know (if anyone wants to explain nicely) how
one would do this with vectors and normals.

regards, A Beginner

##### Share on other sites
If the ball is rotating, it won't bounce according to your rules. If it wasn't rotating, it will be after it bounces on a plane with some angle. I've never programmed this myself, but I have played enough billiards to know these things. :)

##### Share on other sites
Quote:
 Original post by icethelogit appears I was overthinking this - if I have sphere intersect with a plane all I needed to do would reflect the direction velocity vector at the surface normal, then divide velocity by an offset that alters depending on what direction you hit; the same concept as when you hit the floor and bounce you invert the y velocity and weaken it. probably a cheap hack, but you can't tell when looking.

Yes, you're right, but if the balls bounce off each other then you will need to do some maths. I found this tutorial very good:
http://www.tonypa.pri.ee/vectors/start.html

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633330
• Total Posts
3011385
• ### Who's Online (See full list)

There are no registered users currently online

×