Some really cool eye movements can be acheived using a simple, but powerful feature in RandomEyes, the Look Target in conjunction with the Animation Curves editor. The Look Target links a GameObject to the component and calculates eye movment based on relative location of the object to the eyes. This tip will be utilizing RandomEyes3D, most of the discussion will also apply to RandomEyes2D. Here's a quick demo of what it looks like:
While RandomEyes can be paired up with any GameObject to implement tracking, an Empty object can be used to create some very interesting eye movements without using an object that would potentially be visible in the scene. Let's get started:
With your character in-scene and the RandomEyes component applied to it, create an Empty by selecting the GameObject menu and selecting Create Empty.
Rename your Empty with a meaningful name and position the Empty object in front of your character. In our example, our Empty is called "target".
Partner up the "target" object with the RandomEyes3D component, linking the Look Target to the "target" object. Select the character object, then drag the "target" object to the Look Target link slot.
Open up the Animation window if it is not already opened:
Next, create an AnimationClip for the "target" object. Select the "target" object, then click the Add Curve button in the Animation window. Choose a meaningful name and meaningful location for the AnimationClip file. After you save the file, use the object browser to add the "Transform: position" property to the Curves editor.
Switch from Dope Sheet view to Curves view:
Select the "Position.X" element and create a curve similar to the following. Keep the boundaries between -2 and 2 for starters. Making the transform motion too large can cause the eye movment to create a box pattern as the tracking function exceeds the allowed boundaries.
- Use SHIFT + mouseWheel to control vertical value axis range.
- Use CTRL + mouseWheel to control horizontal time axis range.
Select the "Position.Y" element and create a curve similar to this one:
When viewed together, the curves should be offset from each other about 1/4 of a cycle period:
You can now play the scene and the character's eyes should track a circular motion. Try experimenting with the x and y curves to see what other cool, interesting movements you can make your character's eyes make! Here are a couple more curve options for inspiration: