- Home /
Sharing some but not all animator states between characters
Hi there!
I am developing a fighting video game and I have two types of animations for the characters:
A pack of basic states that all characters share (Idle, Run, Hit, etc).
A specific pack for each character (generally their attacks).
The idea would be to be able to override only the basic animations and also to be able to blend between any state (shared or specific).
To achieve this I have separated the animations in two animators: one for the shared state pack and another one specific to each fighter with his attacks. This way I can create an AnimatorOverrideController only for the one that contains the shared states.
The problem with this comes when I want to blend between animators because there can not be a transition to a state not contained in the same animator. To solve this here is the solution that I have invented: I add in each animator an initial state "EntryPoint" with a dummy animation of which I make override each time that I change animator. For example:
The fighter is running towards the enemy: we are in the shared animator because "Run" is a shared state.
Once the fighter is close enough we launch an attack. To do this we need to do the following:
We take the specific animator (the one with the attacks) and override its EntryPoint state with the "Run" animation.
We move the time of the animation to match exactly in the same frame so that the change is not noticeable.
From here I blend the animation of the attack I am interested in.
And it works! But I have the feeling that it's a bit of a far-fetched solution. We are just starting the project and it is now when the key decisions are made. I would not like to start building something on a base that maybe is not quite right. Also the case where some characters share only a set of states doesn't seem too unusual to me. Is there a simpler/obvious solution that I might have missed?
Many thanks in advance!
Your answer
Follow this Question
Related Questions
Using Override Animation Controllers (NOT WORKING) 0 Answers
Is there a way to change the WrapMode of all Animations in a Mecanim Animator? 1 Answer
What is the difference between Animator Controller and Animation component? 1 Answer
Animation Mecanim - Parts of model displaces after animating 0 Answers