+ 1

Canvas collision detection not working properly

Hi! I have made a canvas in which balls collides with eachother and changes its direction after collision. Mine problem is collisoin related, it has nothing to do with canvas. When you will make many balls in web app then balls will start to stuck in eachother. Even if there are only two balls, there is possibility that they will stuck in each other and start vibrating. Problem is in update method of Circle class Can anyone please help me to solve this issue?? https://code.sololearn.com/W84lUKvncOyw/#

23rd May 2022, 1:44 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
2 odpowiedzi
23rd May 2022, 6:46 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
+ 1
David Dolejší You are right When balls intersect each other then they start changing directions periodically I have to find some way so that they do not intersect or after intersection they come out of each other right after next frame
24th May 2022, 9:20 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar