Hi,
So, a few animation questions:
1. My player character controller seems to ignore the talk animation. I've set up a 'heroTalk_L' animation and added it to the player controller, however when the player talks the controller still plays the 'heroIdle' animation and does not switch to the talk one (see pics).
What could be the cause of this? (btw, set up talking animation for the green-shirt npc and it works fine with him...)
2. Is there a simple way to randomize the order in which the frames in a given animation are played? (useful for talking animation...)
3. I have eye blinking animations which I want to randomly trigger when the character is not talking. What would be the best approach to implement this? Should I create an action list that will run in the background or something?
Thanks!
Comments
Sprites Unity Complex animation is covered in Section 3.9 of the Manual, and a sample variant of the 2D Demo's Player character can be found in /Assets/AdventureCreator/2D Demo/Resources/Brain2D_SpritesUnityComplex.
2) AC can do one better than random talking frames, as you can use text-based lipsyncing. Go to the Speech Manager and set Lip syncing to From Speech Text, and Perform Lipsync on to Portrait And Game Object.
When your character uses Sprites Unity Complex, you will then be able to define a Phoneme integer parameter that can be used to play a different talking frame accordingly.
3) Once using Sprites Unity Complex, you can then set up your Animator so that your Idle animation transitions to a Blinking animation every so often, provided that the "Move speed" float parameter is zero.
Once you've moved over to Sprites Unity Complex, you can re-wire your Animator so that a different "Phoneme" integer parameter causes a different talking frame to play while the character's "Talk bool" parameter is True.
Again, see the included example character for how to play talking animations based on a boolean parameter.
A simple script could then simply change this phoneme parameter at runtime to a new random value every few frames, e.g.:
private void OnStart ()
{
StartCoroutine (RandomisePhoneme ());
}
private IEnumerator RandomisePhoneme ()
{
while (true)
{
int randomValue = Random.Range (0, 5);
GetComponent <Animator>().SetInteger ("Phoneme", randomValue);
yield return new WaitForSeconds (0.2f);
}
}