Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
I am implementing a game where the objects are rectangle bounded. But once a collision has taken place, they need to move like how pool balls would move when they have collided. I saw some pool game collision responses but they are all for circle bounded objects. Please advice how to do the same pool collision response to my rectangle bounded objects. A dynamic object collides with a static object after which both the objects need to behave like pool balls. Please help.
Posted
Comments
Sergey Alexandrovich Kryukov 25-Mar-14 11:49am    
Not clear. Is the rectangular bounding a simplification (which you consider simpler as round bounding), or you really want to model collision of rectangular objects in your physics? It would be much more complex then round objects. Do you want to consider all classes of interactions, rotation of rectangular object, energy of rotation, etc.? And... let me ask you... do you really understand all the physics of your model?
—SA
mayooran99 25-Mar-14 11:54am    
I have come so far with rectangular bounding and I have implemented the collision detection part as well. Once they have collided, they need to move like pool balls. Please help me with an algorithm that I can apply for rectangle objects.
Sergey Alexandrovich Kryukov 25-Mar-14 12:03pm    
You did not answer. Collided as round balls, or not? If as round balls, throw away rectangular bounding.
—SA
mayooran99 25-Mar-14 12:31pm    
no, not collided as round balls. I referred to the round balls just to mention that I need the same logic of that of the pool game. Please advice.

1 solution

Even if you limit yourself to the collision of rectangles, the actual physics is not simple, see, for instance this page: MyPhysicsLab – Rigid Body Collisions[^]. For more complex shapes things start becoming interesting...[^].
 
Share this answer
 
Comments
Nelek 25-Mar-14 19:40pm    
Nice example
CPallini 26-Mar-14 9:15am    
Thanks.
TorstenH. 26-Mar-14 7:56am    
That depends on how one let's the rectangle object collide: in various direction or just face to face.

face to face collisions would make the math much simpler!
CPallini 26-Mar-14 9:17am    
Yes, that would be just like point to point collision (with possibly different masses). Such a case has 0 propbability, However it can be a deliberately forced scenario, of course.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900