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.
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.
Thanks that you guys have been a great help!
No problem. Did the script work for you?
Yes it did, with a little tweaking, thanks!
Do you know how to do the same using Animator component?
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
Answer by DaveA
Sep 10, 2011 at 03:11 AM
Yes, why not?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
7 People are following this question.
How to play multiple animations on the same game object.
Can I make animations snap to a frame?
Mecanim BlendTree non-linear behaviour?
Animated character from Maya to Unity problem
Using Locomotion with different avatars