Animation blend problems

Hello,

I have yet another nub problem that I can’t seem to figure out. I’m having some problems with animations. They’re not blending properly. I’m sure I’m just missing something small, but I just can’t see it. I set up a simplified version of the file/problem for easier explanation of the problem.

The goal for the project is a game to be released on the iPhone. I’ve created an input script that I can toggle between computer input and phone input so please pay no mind for the keyboard input.

File Setup:
A character animated and exported in one .fbx file. Animation has the following animations…

  • Idle is the character standing still. Plays when W, A, S, or D is not pressed.
  • MoveForward is when the user makes the character move forward. Animation linked to Vertical Positive (W).
  • MoveBackward is when the user makes the character move backward. Animation linked to Vertical Negative (S).
  • ShiftLeft is when the user makes the character strafe left. Animation linked to Horizontal Negative (A).
  • ShiftRight is when the user makes the character strafe right. Animation linked to Horizontal Positive (D).

Goal:
Want to blend move animations and shift animations when the user pushes a combination of buttons. When buttons are released, animation blends to Idle animation.

Goal Details:
When the user pushes W, the character plays the MoveForward animation. If the user pushes W and A, a blend of MoveForward and ShiftLeft animations played smoothly. When the user releases W and A, the blend of MoveForward and ShiftLeft smoothly transitions to Idle.

Current Result:
When I push W, the move forward animation plays. Same with A, S, and D. However, when I push any combination of Move and Shift, there is no blend. It only plays one of the animations. In this case, it would play MoveForward as it is processed first in the code.

I have looked through the Animation API, tried animation.Blend() and animation.CrossFade() but they both yield the same result.

Any input would be very helpful, even if it’s just to point me to the right direction.

Thanks in advance.

-S

-bump-
Still can’t get the animations to work properly. Any thoughts?
-S

You probably want to put your Idle, Move, and Shift animations in different animation layers.
Take a look at Unity - Scripting API: AnimationState
Specifically look at AnimationState.weight and AnimationState.layer.
You can probably piece together what you need from there.

@ThermalFusion
Thank you for the reply. I forgot to respond to your post. Sorry.
I actually figured out the problem from reverse-engineering Unity’s example projects. In short, all of my animations were in one .fbx instead of different .fbx files. I appreciate the reply though :slight_smile: I’ll be sure to utilize that post after I recreate all of the animations.
-S