FANDOM


Note: This is an alternative integration for Rogo LipSync and is intended to allow emotions and mouth movement to be played independently from any audio. The integration consists of three AC actions. These will be posted in separate articles to avoid clutter.

Author's quote:

Use this as a means to have emotions/mouth movement that plays with text (no audio) and limit the .asset files to just a handful - short speech, medium speech, long speech. I also use it for asset files that just sync gestures and emotions. 
To use it replace the text in a .cs file named RogoLipSync_SetEmotion with this text, or create a new blank text file, then paste the text and rename the file RogoLipSync_SetEmotion.cs. Then drop the file into the folder named actions inside the Adventure creator folder. Then, just use the action in an action list.

The code for the Set Emotion action is as follows:

using UnityEngine;
using System.Collections;
using RogoDigital.Lipsync;


#if UNITY_EDITOR
using UnityEditor;
#endif
 
 namespace AC
 {
     [System.Serializable]
    public class RogoLipSync_SetEmotion : Action
     {
         public bool isPlayer;
        public LipSync lipSyncTarget;
        public string emotion;
        public float blendTime;
        
 
         public RogoLipSync_SetEmotion()
        {
             this.isDisplayed = true;
            category = ActionCategory.Custom;
            title = "Rogo LipSync - Set Emotion";
            description = "Blends a LipSync emotion on a LipSync component";
            isPlayer = true;
            
         }
 
         override public float Run()
        {
             if (isPlayer)
            {
                 lipSyncTarget = KickStarter.player.GetComponent<LipSync>();

                if (lipSyncTarget == null)
                {
                    Debug.LogWarning("RogoLipSync_Play: No LipSync component found on Player.");
                    return 0f;
                }
            }
 
             else if (lipSyncTarget == null)
            {
                 Debug.LogWarning("RogoLipSync_Play: No LipSync component defined.");
                return 0f;
            }
 
             lipSyncTarget.SetEmotion(emotion, blendTime);
            return 0f;
        }
 
 
         override public void Skip()
        {
 
         }
 
 
 
 #if UNITY_EDITOR
        override public void ShowGUI()
        {
             isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);

            if (!isPlayer)
            {
                 lipSyncTarget = (LipSync)EditorGUILayout.ObjectField("Character:", lipSyncTarget, typeof(LipSync), true);
            }
 
             emotion = EditorGUILayout.TextField("Emotion:", emotion);
            blendTime = EditorGUILayout.Slider("Blend Time:", blendTime, 0f, 5f);
            AfterRunningOption();
        }
 #endif
     }
 }

It's also important to note that this specific action (SetEmotion) may not play if there is a competing animation already playing at the time.

-Original code provided by user Larsos-

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.