Adventures with Physics: How to Roll an Egg

Hello everyone, I’m Peter Kinney, gameplay programmer and secondary game designer here at Dark Clutches. My latest project has been figuring out how to make an egg roll along the ground convincingly, and to do it without relying on unity’s physics collision system. We’re avoiding the use of the existing collision system because as powerful as it is it doesn’t give the developer very much control.

Eggs are not round

Eggs are not round

While it’s easy enough to add a ball into the world and have it roll around, an egg rolling like a ball just doesn’t look right. The solution is a combination of pseudo-physics and some slight of hand.

The trick is that it’s still a ball, but the egg model moves inside the sphere so that it touches the surface the ball is rolling on. This alone turned out to be enough while the egg was rolling, but when it slowed to a stop it would sometimes be upside-down.

In order to get the egg to settle properly, we simply added a force that pulls the ball towards the fat end of the egg. Moving the ball this way makes it roll, bringing the fat end closer to the ground. This way, the egg will rock back and forth until it settles upright (I realize that eggs don’t actually sit upright, but it’s not obviously wrong and it works better in the game).