SFML community forums

General => SFML projects => Topic started by: Lucario1111 on January 20, 2015, 11:23:08 pm

Title: Help! Pool game project.
Post by: Lucario1111 on January 20, 2015, 11:23:08 pm
Hi all,
Thanks for stopping by and reading this. (This is my first post so sorry if I should have formatted this differently)
I've been trying to work on a pool game for a project written in c++. So far I've gotten down part of the collision function. For most of the collisions, the balls bounce of each other at the right velocity, but sometimes, when they overlap, the balls circle each other and go into a weird twirling motion. A similar situation occurs when a ball is stuck in the side of the window, it vibrates back and forth but remains stuck in the border.
Code is in the attachment, any feedback would be greatly appreciated.
Title: Re: Help! Pool game project.
Post by: G. on January 20, 2015, 11:27:52 pm
I didn't watch your code.
You should separate your balls ( :-[ ) before applying the collision reaction to them.
Title: Re: Help! Pool game project.
Post by: Jesper Juhl on January 20, 2015, 11:47:26 pm
You may want to read this: Pool Hall Lessons: Fast, Accurate Collision Detection Between Circles or Spheres (http://www.gamasutra.com/view/feature/131424/pool_hall_lessons_fast_accurate_.php?print=1).