PART ONE: TRACKING A TARGET
Using Unity Version 2019.4
There are a few creative hills I’m willing to die on, no matter how basic the game is. One of those hills is eye movement.
At the very least, eye movement can direct player attention, but there’s much more to it than that. In reality, our eyes also convey focus, personality and emotion; we abandon a crucial human element if we negate that in our character design. In fact, a character staring lifelessly in one direction can hurt immersion significantly.
So for me, eye movement is a must. And fortunately, it’s quite simple to implement.
Your character has dull, lifeless eyes. You want them to look at points of interest or look around their surroundings, but they only stare blankly ahead.
This is the first in a two-part tutorial that will go through two different ways to tackle eye movement: 1) Using eyes that are rigged to bone transforms, and 2) using an offset on the texture UV for the eyes. In part one, we'll set up our movement system and implement a function to track targets. In part two, we'll get a bit fancier.
Obviously, there are exceptions to the below criteria, but basically, you will want to use:
Eye bone transforms
If your character has separate eye meshes rigged and weighted to bones, and
The eye meshes are spherical
Texture UV Offset
If your character has eye meshes that are not rigged to bones, or
The eyes are part of the character mesh, but have their own material, or
The eye meshes are flat or non-spherical
Before we get into specifics, let’s break down how these approaches work differently.