Forum Discussion
Romans_I_XVI
10 years agoRoku Guru
I did it!!!
I fixed the problem of balls passing through each other! Here's a video with a very crowded space, and yet are collisions working properly 8-) .
https://youtu.be/2YFNhNFcnkM
Essentially I added an entire new function that checks if the total distance between two balls is less than it should be ( i.e. One is inside of the other, even just slightly ). If so I simply adjust the x and y positions ( without touching the speeds at all, since that is what the other function does ) so that it is at the point where the edges are just barely touching, essentially where it would be in a real world collision where balls passing through each other is physically impossible lol.
The solution wasn't necessarily easy, but it was much easier than some of the other madness I was trying, and it is also a much more elegant solution.
:mrgreen:
I fixed the problem of balls passing through each other! Here's a video with a very crowded space, and yet are collisions working properly 8-) .
https://youtu.be/2YFNhNFcnkM
Essentially I added an entire new function that checks if the total distance between two balls is less than it should be ( i.e. One is inside of the other, even just slightly ). If so I simply adjust the x and y positions ( without touching the speeds at all, since that is what the other function does ) so that it is at the point where the edges are just barely touching, essentially where it would be in a real world collision where balls passing through each other is physically impossible lol.
The solution wasn't necessarily easy, but it was much easier than some of the other madness I was trying, and it is also a much more elegant solution.
:mrgreen: