Useful variable to use/animate mouth?
Useful variable to use/animate mouth?
Hi,
I have a mouth talk animation for my character. I want to use it as long as the voice actor line is playing. (also stop it when player just spam on "Continue" button as well).
What is good variable that I can reference to?
I am using a custom Lua script to start/stop mouth animation right now.
I have a mouth talk animation for my character. I want to use it as long as the voice actor line is playing. (also stop it when player just spam on "Continue" button as well).
What is good variable that I can reference to?
I am using a custom Lua script to start/stop mouth animation right now.
Re: Useful variable to use/animate mouth?
Hi,
Use sequences. This is a very common thing to use sequences for.
Let's say the speaker has an Animator component with two states: Talk (mouth talking) and Idle (mouth closed). Set the Dialogue Manager's Default Sequence to:
The first line plays the "Talk" state on the speaker's Animator.
The second line:
Use sequences. This is a very common thing to use sequences for.
Let's say the speaker has an Animator component with two states: Talk (mouth talking) and Idle (mouth closed). Set the Dialogue Manager's Default Sequence to:
Code: Select all
AnimatorPlay(Talk);
required AnimatorPlay(Idle)@Message(Typed)
The second line:
- Waits until the sequencer receives the sequencer message "Typed". The Dialogue System's typewriter effects send this sequencer message when they finish typing.
- When it receives the sequencer message, it plays the "Idle" animation.
- The 'required' keyword guarantees that the sequence plays this command even if the player uses the continue button to skip ahead.
Re: Useful variable to use/animate mouth?
Great-
I have to probably use Lua Script though since my facial animation is a custom thing so I will call a function from C# that is linked to Lua.
Would Script in each node would work with "@Message(Typed)"??
I have to probably use Lua Script though since my facial animation is a custom thing so I will call a function from C# that is linked to Lua.
Would Script in each node would work with "@Message(Typed)"??
Re: Useful variable to use/animate mouth?
Yes. Or you could call your custom C# code in a custom sequencer command. (tutorial)
Re: Useful variable to use/animate mouth?
Great.
So I created 2 C# files like below
In each dialogue node I have below..
and in the "default sequence" command
It seems to be working but let me know if this is the right way to do it.
Any possible way to match the typed to the audio file length?
So I created 2 C# files like below
Code: Select all
public class SequencerCommandStartTalkAnimation : SequencerCommand
{
public void Awake()
{
Debug.Log(speaker.gameObject.name + " started talking..");
Stop();
}
}
Code: Select all
AudioWait(VA/Yuna_train_v02/What_should_my_next_song_v02);
AnimatorTrigger(Idle);
{{default}};
Code: Select all
StartTalkAnimation();
required StopTalkAnimation()@Message(Typed);
Delay({{end}});
Any possible way to match the typed to the audio file length?
Re: Useful variable to use/animate mouth?
Hi,
Yes, that looks fine.
Eventually you may want to use entrytags. Then you can leave the dialogue node's Sequence field blank, and set the Default Sequence to:
Each dialogue node will automatically replace the keyword 'entrytag' with the node's entrytag value.
Yes, that looks fine.
Eventually you may want to use entrytags. Then you can leave the dialogue node's Sequence field blank, and set the Default Sequence to:
Code: Select all
AudioWait(entrytag);
StartTalkAnimation();
required StopTalkAnimation()@Message(Typed);
Delay({{end}});
Re: Useful variable to use/animate mouth?
Yup, Im planning to do that once my structure is in good state. I guess its almost there (thanks to your quick responses )
One thing though..
I ended up having these in Script section of each node:
which is fine but I'm afraid of possible type errors. Is there any way to setup a enum here or possible extend the each node inspector with my own stuff? is there any template for it as well?
One thing though..
I ended up having these in Script section of each node:
Code: Select all
SetFacialEmotion("Wha");
PlayEmote("Exclamation")
Re: Useful variable to use/animate mouth?
There's no good way to do that. But you can define separate functions such as:
SetFacialEmotion_Wha()
PlayEmote_Exclamation()
etc.
Then add them to a CustomLuaFunctionInfo asset so you can select them from a dropdown menu instead of typing them.
SetFacialEmotion_Wha()
PlayEmote_Exclamation()
etc.
Then add them to a CustomLuaFunctionInfo asset so you can select them from a dropdown menu instead of typing them.