SALSA LipSync Logo

RandomEyes Classes, Methods, & Properties



RandomEyesLookStatus

This class is passed as a parameter by the [RandomEyes_OnLookStatusChanged] event.

Public properties

RandomEyesLookStatus.instance (object)

A reference to the RandomEyes class instance of the broadcast sender.

RandomEyesLookStatus.lookPosition (enum)

The current RandomEyesLook.Position

RandomEyesLookStatus.blendSpeed (float)

A float value of the current blend speed

RandomEyesLookStatus.rangeOfMotion (float)

A float value of the current range of motion


RandomEyesLook

This class is passed as an enum parameter when setting the RandomEyes [Look] function.

Public enumerator

RandomEyesLook.Position.[Position]

Contains: { UpRight, Up, UpLeft, Right, Forward, Left, DownRight, Down, DownLeft, and Blink}


RandomEyes2D

This class provides eye movement and blinking control for your 2D characters using sprite-based eyes and eyelids. Available from:

  • [Component] → [Crazy Minnow Studio] → [RandomEye2D] menu

  • or from the Inspector, under [Add Component] → [Crazy Minnow Studio] → [RandomEye2D]

Public enumerator

RandomEyes2D.SpriteRend.[character part]

Contains: { Character, Eyes, EyeLids }

Public eye/blink functions - (Only needed if you don't want to use random eye movement and blinking)

RandomEyes2D.Look(RandomEyesLook.Position.Forward)

Moves all eyes in the [Eyes][SpriteRenderer] array to the specified look position.

RandomEyes2D.Blink(float duration)

Blinks the eyelids for the specified duration.

RandomEyes2D.SetOrderInLayer(RandomEyes2D.SpriteRend.Eyes, int layer)

Specify the RandomEyes2D.SpriteRend enumerator you wish to order, and the layer number.

RandomEyes2D.SetLookTarget(GameObject target)

Set the look target for eye tracking.

RandomEyes2D.SetTargetAffinity(boolean status)

Enable/disable look target affinity.

RandomEyes2D.SetAffinityPercentage(float percentate)

Set the affinity percentage to a normalized value from zero to one.

RandomEyes2D.SetRandomEyes(boolean status)

Enable/Disable random eye movement.

RandomEyes2D.SetBlink(boolean status)

Enable/Disable random blinking.

RandomEyes2D.SetRangeOfMotion(float range)

Use this to set the eye movement range of motion.

RandomEyes2D.SetBlendSpeed(float speed)

Use this to set the eye movement speed.

RandomEyes2D.SetBlinkDuration(float duration)

Use this to set the duration the eyes remain shut during a blink.

 


RandomEyes3D

This class provides eye movement and blinking control for your 3D charcters using BlendShape eye and eyelid positions (look up, look down, look left, look right, and blink). It also provides unlimited custom shapes by linking BlendShape indexes. Available from:

  • [Component] → [Crazy Minnow Studio] → [RandomEyes3D] menu

  • or from the Inspector, under [Add Component] → [Crazy Minnow Studio] → [RandomEyes3D]

Public properties

RandomEyes3D.lookAmount (RandomEyesBlendAmounts)

  • RandomEyes3D.lookAmount.lookUp (float)
  • RandomEyes3D.lookAmount.lookDown (float)
  • RandomEyes3D.lookAmount.lookLeft (float)
  • RandomEyes3D.lookAmount.lookRight (float)
  • RandomEyes3D.lookAmount.blink (float)

RandomEyes3D.lookAmount is a custom type that contains the look and blink blendShape amounts. It's updated in realtime and provides direct access to the values even when no SkinnedMeshRenderer is linked. This is useful for asset integrators that want to use RandomEyes3D as an eye movement engine with their own integration.

Public eye/blink functions - (Only needed if you don't want to use random eye movement and blinking)

RandomEyes3D.Look(RandomEyesLook.Position.Forward)

Moves all eyes in the [Eyes][SpriteRenderer] array to the specified look position.

RandomEyes3D.Blink(float duration)

Blinks the eyelids for the specified duration.

RandomEyes3D.SetLookTarget(GameObject target)

Set the look target for eye tracking.

RandomEyes3D.SetTargetAffinity(boolean status)

Enable/disable look target affinity.

RandomEyes3D.SetAffinityPercentage(float percentage)

Set the affinity percentage to a normalized value from zero to one.

RandomEyes3D.SetRandomEyes(boolean status)

Enable/Disable random eye movement.

RandomEyes3D.SetBlink(boolean status)

Enable/Disable random blinking.

RandomEyes3D.SetRangeOfMotion(float range)

Use this to set the eye movement range of motion.

RandomEyes3D.SetBlendSpeed(float speed)

Use this to set the eye movement speed.

RandomEyes3D.SetBlinkDuration(float duration)

Use this to set the duration the eyes remain closed during a blink

RandomEyes3D.SetBlinkSpeed(float speed)

Use this to set the blink speed

RandomEyes3D.SetOpenMax(float openAmount)

Set the maximum amount the eyes can open (0=max)

RandomEyes3D.SetCloseMax(float closeAmount)

Set the maximum amount the eyes can close (100=max)

 

Public Shape functions – (Not required, but can be used to enhance your character with single BlendShape facial expressions)

 

RandomEyes3D.SetCustomShapeRandom(bool status)

Set (true) to activate random custom shapes and (false) to deactivate.

RandomEyes3D.SetCustomShape(string shapeName)

Set a custom shape as the [Current Custom Shape] using a shapeName. All other shapes that are not overridden will be deactivated.

RandomEyes3D.SetCustomShape(int shapeIndex)

Set a custom shape as the [Current Custom Shape] using a shape index. All other shapes that are not overridden will be deactivated.

RandomEyes3D.SetCustomShape(string shapeName, float duration)

Set a custom shape as the [Current Custom Shape] using a shape name, for a specified duration. All other shapes that are not overridden will be deactivated.

RandomEyes3D.SetCustomShape(int shapeIndex, float duration)

Set a custom shape as the [Current Custom Shape] using a shape index, for a specified duration. All other shapes that are not overridden will be deactivated.

RandomEyes3D.SetCustomShapeOverride(string shapeName, bool overrideOn)

Activate a custom shape by name, with override (true), this will activate it regardless of the status of other custom shapes or the [Current Custom Shape]. Deactivate with override (false).

RandomEyes3D.SetCustomShapeOverride(int shapeIndex, bool overrideOn)

Activate a custom shape by index, with override (true), this will activate it regardless of the status of other custom shapes or the [Current Custom Shape]. Deactivate with override (false).

RandomEyes3D.SetCustomShapeOverride(string shapeName, float duration)

Activate a custom shape by name, for a specified duration regardless of the status of other custom shapes or the [Current Custom Shape]. The custom shape will automatically deactivate after the specified duration.

RandomEyes3D.SetCustomShapeOverride(int shapeIndex, float duration)

Activate a custom shape by index, for a specified duration regardless of the status of other custom shapes or the [Current Custom Shape]. The custom shape will automatically deactivate after the specified duration.

RandomEyes3D.SetCustomShapeOverride(string shapeName, float blendSpeed, float rangeOfMotion, bool overrideOn)

Set override on a custom shape by name, to true or false, and set the blendSpeed and rangeOfMotion.

RandomEyes3D.SetCustomShapeOverride(int shapeIndex, float blendSpeed, float rangeOfMotion, bool overrideOn)

Set override on a custom shape by index, to true or false, and set the blendSpeed and rangeOfMotion.

RandomEyes3D.SetCustomShapeOverride(string shapeName, float blendSpeed, float rangeOfMotion, float duration)

Set override on a custom shape by name, for the specified duration, and set the blendSpeed and rangeOfMotion.

RandomEyes3D.SetCustomShapeOverride(int shapeIndex, float blendSpeed, float rangeOfMotion, float duration)

Set override on a custom shape by index, for the specified duration, and set the blendSpeed and rangeOfMotion.

RandomEyes3D.SetCustomShapeBlendSpeed(string shapeName, float blend)

Set the blendSpeed of a custom shape using a shape name.

RandomEyes3D.SetCustomShapeBlendSpeed(int shapeIndex, float blend)

Set the blendSpeed of a custom shape using a shape index.

RandomEyes3D.SetCustomShapeRangeOfMotion(string shapeName, int range)

Set the rangeOfMotion of a custom shape using a shape name.

RandomEyes3D.SetCustomShapeRangeOfMotion(int shapeIndex, int range)

Set the rangeOfMotion of a custom shape using a shape index.

RandomEyes3D.AutoLinkCustomShapes(bool excludeEyeShapes, Salsa3D excludeSalsaShapes)

Auto-link all BlendShapes from the SkinnedMeshRenderer. Be sure to link the RandomEyes3D.skinnedMeshRenderer field prior to using this function, or nothing will be linked.

Public Group functions – (Not required, but can be used to enhance your character with complex multi-BlendShape facial expressions)

RandomEyes3D.SetGroup(string groupName, bool status)

Activate or deactivate a group of BlendShapes.

RandomEyes3D.SetGroup(string groupName, float duration)

Activate a group of BlendShapes for a specified duration.

Broadcast events

Broadcast Custom Shape Events

Add this event to any script attached to any of your [Broadcast Eye Events] > [Broadcast Receivers], or their children if you have [Propogate To Children] checked in the Inspector, to determine which RandomEyes script instance sent the broadcast, which lookPosition was just set, at what blendSpeed, and at what rangeOfMotion.

C#:


void RandomEyes_OnCustomShapeChanged(RandomEyesCustomShapeStatus status)
{
	Debug.Log("RandomEyes_OnCustomShapeChanged:" +
		" instance(" + status.instance.GetType() + ")," +
		" name(" + status.instance.name + ")," +
		" shapeIndex(" + status.shapeIndex + ")," +
		" shapeName(" + status.shapeName + ")," +
		" overrideOn(" + status.overrideOn + ")," +
		" isOn(" + status.isOn + ")," +
		" blendSpeed(" + status.blendSpeed + ")," +
		" rangeOfMotion(" + status.rangeOfMotion + ")");
}

JavaScript:


function RandomEyes_OnCustomShapeChanged(status : RandomEyesCustomShapeStatus) {
	Debug.Log("RandomEyes_OnCustomShapeChanged:" +
		" instance(" + status.instance.GetType() + ")," +
		" name(" + status.instance.name + ")," +
		" shapeIndex(" + status.shapeIndex + ")," +
		" shapeName(" + status.shapeName + ")," +
		" overrideOn(" + status.overrideOn + ")," +
		" isOn(" + status.isOn + ")," +
		" blendSpeed(" + status.blendSpeed + ")," +
		" rangeOfMotion(" + status.rangeOfMotion + ")");
}

 

 

RandomEyes Eye-Movement Unity Asset Logo