Get the latest tech news

2D Rigid Body Collision Resolution


From Mario bouncing off a Goomba to two cars bumping into each other in a racing game, dealing with collisions is such an integral part of most video games that we often take it for granted.

In order to make things move on the screen, the game engine needs to continually calculate the positions of the various objects in the scene. If we want our collision behavior to look realistic, we have to ensure that whatever values we pick for Δv⃗a\Delta \vec{v}_{a}Δva​ and Δv⃗b\Delta \vec{v}_{b}Δvb​ satisfy the relevant laws of physics. Unfortunately, the way you calculate the collision normal depends on the shapes (or geometries) of the colliding bodies, so I can't just show you a single formula.

Get the Android app

Or read this on Hacker News