Nadav-01 / Physics_Game

School project based on 2d physics. Written in Java. Pretty crappy, nothing to see here.
0 stars 0 forks source link

Broken Collision Mechanics #9

Closed Nadav-01 closed 5 years ago

Nadav-01 commented 5 years ago

The collision mechanics are broken, and not well implemented. Fix them, by making a new method to calculate the speeds and directions post collision, or by using the link provided: https://www.toptal.com/game/video-game-physics-part-ii-collision-detection-for-solid-objects

Nadav-01 commented 5 years ago

https://gamedevelopment.tutsplus.com/tutorials/when-worlds-collide-simulating-circle-circle-collisions--gamedev-769

better explanation

Nadav-01 commented 5 years ago

Update: Implemented better collision mechanics (using the 2d elastic collision formula in wikipedia. Some problems in the new implemention: When 2 balls come at eachother in an angle (not directly next or above one another), sometimes the collision will not go as it needs to. Example: image

another example: a smaller ball can "stick" to a larger ball and "climb" on its slope, such as: image

Nadav-01 commented 5 years ago

Fixed the first issue. Havent seen the second one yet. Will reopen if it is still a problem, even though im really sure it was a by product of the faulty collision function.