Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unity Character Animation with Mecanim

You're reading from   Unity Character Animation with Mecanim A detailed guide to the complex new animation tools in Unity, packed with clear instructions and illustrated with original content in the context of a next generation zombie apocalypse adventure game

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781849696364
Length 290 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Jamie Dean Jamie Dean
Author Profile Icon Jamie Dean
Jamie Dean
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. The Zombie Attacks! 2. Rigging Characters for Unity in 3ds Max and Maya FREE CHAPTER 3. Interacting with the Environment 4. Working with Motion Capture Data 5. Retargeting Animation 6. Talking Heads 7. Controlling Player Animation with Blend Trees 8. Implementing Ragdoll Physics 9. Controlling Enemy Animation with AI and Triggers Index

Implementing range detection


Our work in Chapter 6, Talking Heads, left us with an enemy that becomes aware of the player on a button click. Let's begin where we left off and improve this to make a smarter enemy that automatically attacks the player when he comes within a certain range.

Looking at the scene

We will start by opening our scene:

  1. In the Unity project, open Chapter9_Start by navigating to File | Open Sceneā€¦ | Chapter9_Start.

    The scene consists of the main office geometry and a single female zombie character. The FPSController prefab will allow us to navigate the scene.

  2. Press the Play button in the top center of the Unity interface.

The female zombie is currently set up to idle in place. We can approach and nothing happens at this point:

In the next step, we will add the zombie's AI script and allow her to detect the player.

Adding the initial AI script

We are starting with the zombie's script that we completed in Chapter 6, Talking Heads. The enemy is able to target the player, but we...

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 $19.99/month. Cancel anytime
Banner background image