O'Reilly logo

Unity 2D Game Development Cookbook by Claudio Scolastici

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Rigidbody

Another approach to control a game character is to use a Rigidbody component and make it subject to physics.

The Rigidbody adds several features to make a character behave as if it were a real physical object—it tends to fall down, it is pushed by other objects, and pushes them as well. If you want your game to have a realistic feel, then a Rigidbody is what you need.

The problem is that, more often than you may think, realism doesn't necessarily mean fun and engagement. As a matter of fact, the control style dependent on a Rigidbody is pretty realistic, but it is also not very precise. Momentum, friction, weight... these are all examples of variables you need to manage and appropriately tweak to get optimal game controls. In other ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required