Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Unity Game Development Essentials

You're reading from  Unity Game Development Essentials

Product type Book
Published in Oct 2009
Publisher Packt
ISBN-13 9781847198181
Pages 316 pages
Edition 1st Edition
Languages
Author (1):
Will Goldstone Will Goldstone
Profile icon Will Goldstone

Opening the outpost


In this section, we will look at the two differing approaches for triggering the animation giving you an overview of the two techniques that will both become useful in many other game development situations. In the first approach, we'll use collision — detection a crucial concept to get to grips with as you begin to work on games in Unity. In the second approach, we'll implement a simple ray cast forward from the player.

Approach 1—Collision detection

To begin writing the script that will trigger the door-opening animation and thereby grant access to the outpost, we need to consider which object to write a script for.

In game development, it is often more efficient to write a single script for an object that will interact with many other objects, rather than writing many individual scripts that check for a single object. With this in mind, when writing scripts for a game such as this, we will write a script to be applied to the player character in order to check for...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}