Hi community!
I think the Playable API is very interesting and I see its benefits. So I’ve been reading the available documentation and examples. I really want to learn more about it.
I have some questions about how to implement specific AnimatorController logic, using Playables API.
This is what the AnimatorController looks like (See attached image in case link is lost):
AnimatorController description:
-
There are 5 states: A, B, A2B, B2A and C
-
Default is A, and it has a StateMachineBehaviour that, every loop, chooses randomly between 3 events:
-
Loop A with 20% chance.
This option just replays A and evaluates the random choice again. -
Go to A2B with 30% chance.
This option plays in order the states A2B → B → B2A → A. Then A evaluates the random choice again. Note that every transition between these states has 10% of blend from one to the other. -
Go to C with 50% chance.
This option executes C, which has a BlendTree with 5 animations. It also has a StateMachineBehaviour that randomly chooses the animation to play by setting the blending tree parameter. Then it goes back to A.
It is hard for me to see the Playable Graph tree that executes this logic. In particular I wonder:
- How to make those kind of transitions (A->A2B->B->B2A-A) with the 10% of blending. In the examples I’ve seen only parallel blending with BlendTrees. But this is sequential blending.
- How those StateMachineBehaviours translate into ScriptPlayables in terms of architecture. I mean, should I attach an AnimatorMonoBahaviour to the GameObject/Player that uses all those ScriptPlayables attached to nodes. And trigger them according to logic? or only create them when needed? What is the best architecture here?
- In general, how a transitions between states translate into transitions between graph nodes?
- Is a graph for this possible? Should it be created once at the beginning? or should it be created dynamically?
If someone could help me translate this AnimatorController into Playables it would be really helpfull.
Thanks!
