Skip to main content

EyeFocusControllerSettings

A class in Root.Township, Alta.Character.

Settings asset for EyeFocusController, which picks what a character's eyes look at. Nearby colliders are scored by adding up penalties (detriments) and the lowest score under the maximum wins.

Constructors​

MemberWhat it is
EyeFocusControllerSettings()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

21 private and internal fields
MemberWhat it is
private float baseUpdateIntervalBase time before the eyes look for a new target. The interval is this minus updateWeaknessMultiplier times the target's score.
private Vector3 defaultFocusOffsetWhere the eyes focus, relative to the head, when there is no target.
private Vector3 detectionOffsetCentre of the sphere searched for targets, relative to the head.
private float detectionRangeRadius of the target search sphere, scaled by the player's size.
private float disconnectHorizontalAngleTanTangent of the sideways angle past which a target is dropped or ignored.
private float disconnectVerticalAngleTanTangent of the vertical angle past which a target is dropped or ignored.
private AnimationCurve distanceDetrimentScore penalty by distance from the head. Lowest score wins.
private AnimationCurve horizontalAngleDetrimentScore penalty by sideways angle in degrees.
private bool isUsingRotationLimitsTurns on eye rotation limits. Not read by game code.
private float[] layerDetrimentMaskScore penalty per physics layer, indexed by layer number.
private AnimationCurve leftEyeSplineRotationLimitPointsLeft eye rotation limit curve. Not read by game code.
private LayerMask lookAtPhysics layers searched for things to look at.
private float maximumDetrimentHighest score a candidate can have and still be looked at.
private int maximumOverlapMaximum colliders gathered per search. Default 100.
private float missingRigidbodyDetrimentScore penalty for colliders without a rigidbody.
private AnimationCurve rightEyeSplineRotationLimitPointsRight eye rotation limit curve. Not read by game code.
private float updateMaximumLongest time before looking for a new target. Default 5.
private float updateMinimumShortest time before looking for a new target.
private float updateWeaknessMultiplierHow much a target's score shortens the time before the next search.
private AnimationCurve velocityDetrimentScore change by the candidate's speed. Moving things score lower and so draw the eye.
private AnimationCurve verticalAngleDetrimentScore penalty by vertical angle in degrees.

Properties​

MemberWhat it is
float BaseUpdateInterval { get; }Base time before the focus target is re-chosen. The winning score times UpdateWeaknessMultiplier is subtracted from it.
Vector3 DefaultFocusOffset { get; }Local position the focus handle returns to when there is no target.
Vector3 DetectionOffset { get; }Local offset of the centre of the detection sphere from the head.
float DetectionRange { get; }Radius of the detection sphere, scaled by the head's world scale.
float DisconnectHorizontalAngleTan { get; }Tangent of the horizontal angle past which a target is dropped or ignored (about 50 degrees by default).
float DisconnectVerticalAngleTan { get; }Tangent of the vertical angle past which a target is dropped or ignored (about 30 degrees by default).
AnimationCurve DistanceDetriment { get; }Penalty curve by distance from the head.
AnimationCurve HorizontalAngleDetriment { get; }Penalty curve by horizontal angle (degrees) off straight ahead.
bool IsUsingRotationLimits { get; }Inspector flag for eye rotation limits. Not read anywhere in this build.
float[] LayerDetrimentMask { get; }Extra penalty per physics layer, indexed by layer number (32 entries).
AnimationCurve LeftEyeSplineRotationLimitPoints { get; }Curve for the left eye's rotation limit. Not read anywhere in this build.
LayerMask LookAt { get; }Layers searched for things to look at.
float MaximumDetriment { get; }Score ceiling. Candidates scoring above it are never picked.
int MaximumOverlap { get; }Size of the collider buffer, so the most colliders checked per search.
float MissingRigidbodyDetriment { get; }Penalty for colliders with no attached rigidbody (static scenery).
AnimationCurve RightEyeSplineRotationLimitPoints { get; }Curve for the right eye's rotation limit. Not read anywhere in this build.
float UpdateMaximum { get; }Longest time allowed between re-choosing the focus target.
float UpdateMinimum { get; }Shortest time allowed between re-choosing the focus target.
float UpdateWeaknessMultiplier { get; }How much the winning score shortens the time until the next search.
AnimationCurve VelocityDetriment { get; }Penalty curve by the candidate's speed. By default faster objects score lower (better).
AnimationCurve VerticalAngleDetriment { get; }Penalty curve by vertical angle (degrees) off straight ahead.

Used in​

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