Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Animation controller with a bunch of states - ahh

Discussion in 'Animation' started by Deleted User, Mar 26, 2019.

  1. Deleted User

    Deleted User

    Guest

    So I have these animations:

    Idle
    Run
    Walk
    Walk backwards
    Idle - pistol
    Run - pistol
    Walk - pistol
    Walk backwards - pistol
    Idle - rifle
    Run - rifle
    Walk - rifle
    Walk backwards - rifle

    And now I'm thinking of having to do:
    idle, run, walk, walk backwards all while aiming a pistol or a rifle

    ...so much. Is there an easy way to do this with the animator controller? If I have these parameters in the controller:

    IsRunning bool
    IsWalking bool
    IsAiming bool
    IsMovingForward bool
    and maybe a Jump trigger

    Do I have to make every transition check every parameter? I feel like I'm just not understanding how the controllers work.

    Any help would be greatly appreciated!
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    Make another layer for aiming and give it an AvatarMask to only affect the upper body. Each layer is essentially its own separate state machine so you can have the upper body aiming or idle independent of whatever the base layer is doing.

    I don't see why you would need every transition to check every parameter but I hate the whole AnimatorController system so I don't use it.
     
  3. Deleted User

    Deleted User

    Guest

    What's your alternative to the AnimatorController?

    Say I just have two animations. Walk and Run. How would you do it?
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    There's a link to my Animancer plugin in my signature. It lets you avoid AnimatorControllers and just give your scripts direct references to the AnimationClips you want to use.

    So a movement script can just have AnimationClip fields for walk and run which you assign in the inspector instead of needing to create an AnimatorController, create states, assign clips to the states, create parameters, create transitions, and then still needing to control all that using a script anyway. It means that when you add that script to an object you can clearly see exactly what kind of animations it wants in the inspector instead of needing to read through the whole script to find out which parameters its using and just hoping everything in the AnimatorController is set up correctly.