Unity Community


Results 1 to 1 of 1

  1. Location
    New York, NY
    Posts
    1,197

    2 Animations at once

    I read about animation mixing, but that didn't work for me.

    Code:  
    1. function Animations()
    2. {
    3.     if(weaponsController.gunScript)
    4.     {
    5.         animation.AddClip(weaponsController.gunScript.weaponIdleAnim, "weaponIdleAnim");
    6.         animation.Blend("weaponIdleAnim");
    7.     }
    8.    
    9.     // Running
    10.     if(Input.GetAxis("Vertical") > .1 && controller.isGrounded)
    11.     {
    12.         animation.CrossFade("run", 0.3);
    13.     }
    14.    
    15.     else if(Input.GetAxis("Vertical") < -.1 && controller.isGrounded)
    16.     {
    17.         animation.CrossFade("back", 0.3);
    18.     }
    19.    
    20.     else
    21.     {
    22.         if(Input.GetAxis("Horizontal") && !Input.GetAxis("Vertical") && controller.isGrounded)
    23.         {
    24.             animation.CrossFade("turn",0.3);
    25.         }
    26.         else if (controller.isGrounded)
    27.         {
    28.             animation.CrossFade("idle", 0.1);
    29.         }   
    30.         else
    31.         {
    32.             animation.CrossFade("jump", 0.3);
    33.         }   
    34.     }
    35. }

    Everything is working fine, but I just want "weaponIdleAnimation" to play correctly while you are running, jumping etc. weaponIdleAnimation is being added, but trying to animate it either overrides all the other animations or doesn't play at all.
    Last edited by MrDuskling; 01-31-2012 at 04:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •