x


Animation weight not affecting clip

Really simple code here:

obj.animation[animationClip.name].wrapMode = animationWrapMode; obj.animation[animationClip.name].weight = animationWeight; obj.animation[animationClip.name].speed = animationSpeed;

For the inspector on this script I allow for slotting in the object you want animated (obj) the clip you want to play on that object, picking the wrapmode of the animation from a dropdown, and then setting floats for both weight and speed.

The object plays the animation just fine, and the speed and wrap mode options work perfectly. The weight option doesn't seem to have any effect on the playback of the clip at all. I have a character just looking straight to the right, and it seems like if I set the weight on that clip to 0.5 they should only look halfway to the right. But they don't, they still look all the way to the right.

Any thoughts on this?

more ▼

asked May 08 '12 at 06:52 PM

wilco64256 gravatar image

wilco64256
150 7 15 18

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

2 answers: sort voted first

So is there some way to actually adjust I guess the "intensity" of an animation via script? Basically I want to use this a lot for character facial animations to control how strongly a particular emotion is showing.

more ▼

answered May 15 '12 at 10:03 PM

wilco64256 gravatar image

wilco64256
150 7 15 18

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

The weight affects how it blends with other, currently playing, animations. The docs mention that the last animation in the chain ignores the weights, since the last one just gets everything left over.

To make weight adjust how far you go, play a non-moving idle on layer 0. Then have yours be on layer 1 (or higher.) Now a weight of, say 25% will "leave" 75% for the idle, and Unity will auto-blend the two in that ratio.

more ▼

answered May 09 '12 at 01:21 AM

Owen Reynolds gravatar image

Owen Reynolds
12.2k 1 7 46

(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:

x3935
x27

asked: May 08 '12 at 06:52 PM

Seen: 519 times

Last Updated: May 15 '12 at 10:03 PM