Search Unity

Blendshape Eye Controller (Look At, Random Eyes, and Random Blink)

Discussion in 'Community Learning & Teaching' started by vertgreenheart, May 1, 2015.

  1. vertgreenheart

    vertgreenheart

    Joined:
    May 6, 2011
    Posts:
    61

    Controlling eyes with Unity’s blendshape controller is difficult especially Unity likes to make a blendshape is a float value which harder to control and you can’t even control any movement like down or left. The picture above represents the movement of their eyes. See closely with that cyclops, her eyes were move following that ball, meanwhile the penguin just stuttered with the eye (Random Eye and blink).

    You’re gonna need 4 / 5 basic eye blendshapes like Up eye, Right eye, Down eye, Left eye, and blink (optional).




    This is very useful tool especially for wannabe animator like me.

    Download the script here,




    1. Assign the number / ID of your Blendshape as in your blendshape mesh. I added isDebugging mode, that’ll ease you out finding the number of the blendshape.

    2. After found the right ID, now you’re done! You can control eye movement via 2D Target now. But is that enough ? LOL NOPE!


    3. Sometimes this might happens (A certain eye moves in reverse way), to fix it, just invert the blendshape ID like Positive X Axis was 0 and set it to 1 and Negative X Axis was 1 and set it to 0.
    Now look! Your character will focus on that object forever! But if that’s not please you enough, you can use Random Eyes mover (I forgot to make it move along with your target, so it’ll move along with the center of your head). But if you really do want random movement along your target, then just remove “target” line below randomizer target transform.

    Code (JavaScript):
    1. if(!randomizerTarget){
    2. randomizerTarget = new GameObject("RNDTRG");
    3. randomizerTarget.transform.position = blendshapeEyeMesh.transform.position;
    4. target = randomizerTarget.transform; // remove this
    5. }else{
    6. target.position += Random.onUnitSphere * Time.fixedDeltaTime/randomCompressor;
    7. }
    And so do you want them blink ? just turn on Blinkable and your character will be blinkable. The higher value of blink speed the faster it’ll be. And what is Target Multiplier ? That’s just speed multiplier of your 3D target, how fast / sensitive their eye will follow your 3D target.
     
    theANMATOR2b likes this.
  2. markmozza

    markmozza

    Joined:
    Oct 16, 2015
    Posts:
    86
    Download is dead, can you reupload?
     
  3. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118