Book Image

Unity 2D Game Development Cookbook

By : Claudio Scolastici
Book Image

Unity 2D Game Development Cookbook

By: Claudio Scolastici

Overview of this book

<p>Unity is a powerful game development engine that provides rich functionalities to create 2D and 3D games.</p> <p>Unity 2D Game Development Cookbook is a practical guide to creating games with Unity. The book aims to serve the purpose of exploring problematic concepts in Unity for 2D game development, offering over 50 recipes that are easy to understand and to implement, thanks to the step-by-step explanations and the custom assets provided. The practical recipes provided in the book show clearly and concisely how to do things right in Unity. By the end of this book, you'll be near "experts" when dealing with Unity. You will also understand how to resolve issues and be able to comfortably offer solutions for 2D game development.</p>
Table of Contents (15 chapters)
Unity 2D Game Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 words, with a Rigidbody you get fluidity, but you need to be comfortable with physics and have excellent programming skills to get true control.

With regard to gravity management, a Rigidbody has a parameter called Mass that defines how strong the...