x


Animation Crossfade won't play but Animation Play does

Hi,

I have an animation that I need to play with animation.Crossfade for transitional sake but it doesn't work, only playing two or three frames before stopping. When set up as animation.Play it works fine but the animation transition is unacceptable.

Does anyone know the reason for this and a solution?

more ▼

asked Sep 09 '11 at 12:58 AM

Persona gravatar image

Persona
246 74 85 96

How long is the animation? crossFade, if you don't say, takes 3/10ths sec in and 3/10ths out, so can appear to do nothing on short ones.

Sep 09 '11 at 02:13 AM Owen Reynolds

The animation probably takes roughly two seconds at longest and is about 10 frames?

Sep 09 '11 at 12:45 PM Persona

10 frames "wants" to be about 1/3 of a second (somewhere in there.) So, to clarify, you have animation["shrug"].speed=0.16f; to force it to play slower/longer?

Sep 09 '11 at 03:05 PM Owen Reynolds

Do you have it set as, for example: if(Input.GetKeyDown(x))?

If so try getting rid of the down, as well, try putting it into its own layer: .layer = 1;

Sep 09 '11 at 11:42 PM uberdood12
(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

I've encountered this problem too. As Owen said, CrossFade takes at least 0.3 seconds, so if the animation is shorter than that, it won't work. Manually slowing down the animation in script (changing the .speed) will not work either. If it's a one shot animation, you can sometimes getting away with adding a keyframe through the Unity animation editor that is further down the line to artificially lengthen it... otherwise, you're pretty much relegated to slowing down the animation in a 3d modeling package.

more ▼

answered Sep 09 '11 at 07:42 PM

PrimeDerektive gravatar image

PrimeDerektive
3.1k 57 64 84

Well, if too short is the problem, CrossFade has an optional 2nd parm for the "fade in/out time": animation.CrossFade("shrug", 0.1f); I've had good results with that.

Sep 09 '11 at 11:37 PM Owen Reynolds

Yep... I've gotten models before though where the actual animation is like 5 frames and 0.02 seconds long or something retarded. Setting the crossfade fade in time that low barely results in any visible difference than .Play().

Sep 09 '11 at 11:58 PM PrimeDerektive
(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:

x3786
x3460
x1951
x224
x82

asked: Sep 09 '11 at 12:58 AM

Seen: 2263 times

Last Updated: Sep 09 '11 at 11:58 PM