Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a simple game I'm working on to help me learn unity3d. In my Start() function, I've used the following code to set up my animations.

        walkAnimation = animation["Walk"];
        walkAnimation.layer = 1;
        walkAnimation.blendMode = AnimationBlendMode.Additive;
        walkAnimation.enabled = true;
        walkAnimation.wrapMode = WrapMode.Loop;

        walkBackwardsAnimation = animation["WalkBackwards"];
        walkBackwardsAnimation.layer = 0;
        walkBackwardsAnimation.blendMode = AnimationBlendMode.Additive;
        walkBackwardsAnimation.enabled = true;
        walkBackwardsAnimation.wrapMode = WrapMode.Loop;

        TurnLeftAnimation = animation["TurnLeft"];
        TurnLeftAnimation.layer = 1;
        TurnLeftAnimation.blendMode = AnimationBlendMode.Additive;
        TurnLeftAnimation.enabled = true;
        TurnLeftAnimation.wrapMode = WrapMode.Loop;

        TurnRightAnimation = animation["TurnRight"];
        TurnRightAnimation.layer = 1;
        TurnRightAnimation.blendMode = AnimationBlendMode.Additive;
        TurnRightAnimation.enabled = true;
        TurnRightAnimation.wrapMode = WrapMode.Loop;

Each of them are declared before start like this

public AnimationState walkAnimation;

and I call them depending on the values of the control's axis, like such;

if(Mathf.Abs(Input.GetAxis("Rotate Player")) > 0){
                if (Input.GetAxis("Rotate Player") > 0){
                    animation.CrossFade(TurnRightAnimation.name, 0.2f);
                }

The problem is, The animations don't play, and when I turn while moving my character deforms gruesomely, his arms rise above his head and into his body, other parts grow, etc

I've been battling with mixing animations for the last two weeks, but I'm determined to get it right. If you know anything about this problem please don't hesitate to tell me what it might be. I created the model myself as well, all animations are on a single mesh, and I've tried to make the different animations affect different bones.

share|improve this question
1  
You can't get a animation to play stand alone and you're worried about mixing animations? Have implemented your code from a known good example? Try getting a single animation to play correctly before blending animations. –  Byte56 Jan 14 '13 at 19:40
    
I've gotten my animations to play alone. I just can't get them to mix –  Captain Dando Jan 15 '13 at 4:35
    
What I mean is that they don't play when mixing –  Captain Dando Jan 15 '13 at 4:41
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.