x


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.

more ▼

asked Sep 10, 2011 at 03:06 AM

uberdood12 gravatar image

uberdood12
46 20 17 18

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Sep 10, 2011 at 04:01 AM

GuyFawkes gravatar image

GuyFawkes
61 49 41 41

Thanks that you guys have been a great help!

Sep 10, 2011 at 11:36 AM uberdood12

No problem. Did the script work for you?

Sep 10, 2011 at 01:12 PM GuyFawkes

Yes it did, with a little tweaking, thanks!

Sep 10, 2011 at 08:10 PM uberdood12
(comments are locked)
10|3000 characters needed characters left

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);
}

more ▼

answered Sep 10, 2011 at 03:13 AM

PrimeDerektive gravatar image

PrimeDerektive
3.4k 165 131 153

(comments are locked)
10|3000 characters needed characters left

Yes, why not?

more ▼

answered Sep 10, 2011 at 03:11 AM

DaveA gravatar image

DaveA
33.3k 416 335 442

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x6534
x71
x43
x18

asked: Sep 10, 2011 at 03:06 AM

Seen: 6337 times

Last Updated: Sep 10, 2011 at 08:10 PM