- Home /
Way to play two animations at once?
I was wondering if there is a way to play two animation at once. One animation on the upperbody and one animation on the lowerbody. Something like "Fire" on the upper body and "walk" on the lower body. So the legs still walk while the gun is shooting.
Thanks for any insight on this.
Thanks for it. This worthy question and given answers made my day.
Cheers
Answer by GuyFawkes · Sep 10, 2011 at 04:01 AM
I actually asked the same question a while back, so all of the information I'm posting here is from that question (http://answers.unity3d.com/questions/160848/how-do-i-run-two-animations-at-once-on-the-same-ga.html)
You're going to want to use Animation.Blend. Here's an example of blending: animation.Play("walk"); animation["wave"].layer=1; animation.Play("wave"); animation["wave"].weight=0.4f;
I just wanted to add again, all credit goes here.
Answer by PrimeDerektive · Sep 10, 2011 at 03:13 AM
You can add a mixing transform bone to the animation through script, which will make the animation only effect that bone's transform and all children of that bone.
(So for example, for an upper body shooting animation, you would add the upper torso bone that has all the other upper body bones as children of it, usually spine1 or spine2 or whatever). Like:
var torsoBone : Transform; //drag the bone here in the inspector
function Start(){ animation["shoot"].AddMixingTransform(torsoBone); }
Answer by Max_power1965 · Jun 29, 2016 at 08:06 PM
Hi guys. Here a very step by step tutorial that explain how to play two animations at once: http://gamedevelopertips.com/unity-run-2-animations/
Answer by keroles-M · Jul 09, 2019 at 04:32 AM
You have to use layers: http://docs.unity3d.com/Manual/AnimationLayers.html
Your answer
Follow this Question
Related Questions
Animation.Play blends previous animation 1 Answer
Problem Animation Blend 1 Answer
Increse animation state 0 Answers
How to play multiple animations on the same game object. 2 Answers
Mask Transform options greyed out in Animation import settings -1 Answers