Skip to Main Content
Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation
book

Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation

by Matthew Johnson, James A. Henley
December 2014
Beginner content levelBeginner
384 pages
11h 15m
English
Addison-Wesley Professional
Content preview from Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation

Constraints

The last part of simulating believable objects in the game world is adding constraints to our GameObjects. Constraints allow us to take objects with Rigidbody dynamics and add constraints (limitations) on how they are affected. A good example is a hinged object like a trapdoor. Adding a force against the trapdoor would allow it to drop, but the door would just fall with gravity (either indefinitely or until it hits another collidable object).

By adding a hinge constraint, we are able to tell the physics engine that this object has a point on it that will constrain it to its position but allow it to rotate with the force of gravity pulling on it. By constraining its position and allowing its rotation only in a single axis, we have ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Development with MonoGame: Build a 2D Game Using Your Own Reusable and Performant Game Engine

Game Development with MonoGame: Build a 2D Game Using Your Own Reusable and Performant Game Engine

Louis Salin, Rami Morrar
Game Development Projects with Unreal Engine

Game Development Projects with Unreal Engine

Hammad Fozi, Gonçalo Marques, David Pereira, Devin Sherry

Publisher Resources

ISBN: 9780133523416Purchase book