Skip to main content

EyeFocus

A class in Root.Township, Alta.Character.

Simple component that turns a transform (an eye) to look at a target each frame, then applies a rotation limit.

Constructors​

MemberWhat it is
EyeFocus()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private float eyeMovementSpeedHow fast the eye turns (default 50).
private Quaternion lastRotationThe rotation from the last update, eased from towards the target.
private RotationLimit rotationLimitRotation limit applied after turning.
private Transform targetBacking field for Target.
private Transform toRotateThe transform that is turned.

Properties​

MemberWhat it is
Transform Target { get; set; }What the eye looks at. Null stops it moving.

Methods​

MemberWhat it is
void Setup(Transform toRotate, RotationLimit rotationLimit)Sets the transform to rotate and the rotation limit to apply.
2 private and internal methods
MemberWhat it is
private void ForceUpdate()Editor context menu item that runs one look update.
private void LateUpdate()Eases toRotate towards looking at the target and applies the rotation limit. Does nothing without a target.

Used in​

Members of other types that take, return or hold a EyeFocus: