KybernetikGames / animancer

Documentation for the Animancer Unity Plugin.
63 stars 8 forks source link

Idle in LinearMixerTransition - Pause or Restart #344

Closed wrymn closed 3 months ago

wrymn commented 3 months ago

I have such a mixer transition image

You can see it also contains Idle. This transitions runs on base layer. This idle is for example 10s long, and on 5th second, the character is yawning. When char is just idle, its all fine.

Now the issue is, when I play attack animation on action layer, or even run animation on base layer (with full weight) and then they return to Idle layer, the character suddenly starts yawning, because the IDLE is always playing, just with weight 0.

My question is, is there any good way how to deal with this? I would presume there could be maybe some option to "reset" this idle to beginning, so even if attack or run transitions back to IDLE, yawn part will not start right away.

So maybe there is some technique for this?

Please let me know if I have not explained this issue sufficiently :D

Thank you :)

KybernetikGames commented 3 months ago

mixerState.GetChild(0).Time = 0; would let you reset its time whenever you want.

Having actions like yawning in the main Idle animation is a bit unusual though. I'd usually have a standard Idle as a separate state (even if you also have it in the mixer for the sake of slow movement) and then have a script which waits a customisable amount of time while you stay in the Idle state before playing a random bored action from a few options like how the 3D Game Kit Example does it.