- Home /
Managing Animations & Transitions
Hi,
I'm fairly new to handling 3d animation in Unity, and am looking for some advice on how to organise a large amount of animations and transitions. The animations are played through events in the code, rather than through key inputs. I've watched the tutorial on mechanim animation.
Currently, I'm trying to manage the transition between playing a melee animation and returning to a fighting stance when the melee animation is complete. The melee animation is triggered through code, and all melee animations have a one way transition to the blend tree which contains the fighting stances. The blend tree has a parameter DefaultFightingStance, which is linked to the character's script. This works, but it's very disorganised (see screenshot). Any suggestions on how to organise this? Also, any good reading on the topic would be appreciated. Thanks
How does the fighting system work? Advice is kinda dependent on that.
Is this a combo system? Are the moves selected at random? Are they context-dependent in some other way?
No matter what, you probably want to set up some sub-trees that's organized by attack type.
It's turn based on a grid with square tiles. When the player or an AI makes a melee attack, a call is made to rotate to target -> pause -> animate the attack.
These are just single animations per attack. Currently, the animation clip is selected (through code) based on whether the attack is to a diagonal or orthagonal tile, and depending on whether the attack hits or not, an appropriate hit/dodge clip will be played. Haven't gotten that far yet, though. Cheers!
Answer by Mmmpies · Dec 01, 2014 at 07:49 PM
Probably a good idea to put them in layers. So you have a layer for normal movement, a layer for attack a layer for Swimming or whatever:
Keeps it neater to look at and easier to break the character actions down. So the first one is the Base layer and this next one the swimming.
And reading, well there's the Unity manual and google "mechanim tutorial" will get lots. Really it depends how you prefer learning. For me I'd rather type that search in YouTube and watch a half hour video but mechanim isn't that difficult just takes a while to get your head round.
Looks like you've already got quite a bit done already, just needs tidying up.
Of course these are for my game with yours you'd break down layers to whatever the primary attribute it is that you call first. So if you base it on attacking head create a head layer and do all your attacks for head in there. If you're not sure what I mean just let me know and I'll try and explain more but without knowing your system it's hard to tell.
Yes, have checked out the mechanim tutorial, and it helped me along a bit. Can't quite find anything similar to what I need, but will keep looking.
I'd like to try calling the attack animations through code (Animator.Play) and set up transitions in the animator window to smooth the model's position between attack end and fighting stance start. I don't think I'm doing this correctly, though. Think the issue might be with using a blank state (FightStanceSwitch) and a parameter (default fight stance) to choose the correct fight stance
This is the base layer, where all the attacks transition to (FightStanceSwitch). I've clearly got something wrong here with the sub state machines, any suggestions?
Heh, never$$anonymous$$d... I figured out how to transtion to a specific animation located in a different substate. For anyone else in the same position, one way of transitioning between animations in different substates is to make the transition directly between the animations within the substates, and apply the parameters which will deter$$anonymous$$e which animation in the substate to play.
Your answer
Follow this Question
Related Questions
Is there a way to turn on a transitions hasExitTime on/off through code? 1 Answer
Nicer Mecanim transitions? 1 Answer
Create animation transitions via script. 0 Answers
Talking animation with phonemes smooth transition 0 Answers
How to make a transition animation, intermediate animation between two main states 0 Answers