Search Unity

Modular animation

Discussion in 'Animation' started by joshcamas, Nov 6, 2018.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,277
    Hello friends

    I have a game in which there are two humanoid controllers - first person and third person. This game also has a large variety of weapons, each with their own animations.

    At first, I tried the firewatch way - simply have a bunch of blend trees and substates to make it so all of the weapons are supported.

    However this is not exactly efficient - most changes I make in one controller has to be replicated to the other controller, and now that my weapon system is getting fleshed out, different weapons have different animation structures. In other words, hard coding all animations into 2 massive controllers is simply unsustainable.

    My first idea was to build a blend tree generator, that automatically created blend tree assets per weapon. This worked! However, now that my weapons aren't simply a few blend trees, but would require actual sub state machines, this does not work. And due to how state machines work, I can't simply plug them into my controller. (since there is no way for the parent state itself to decide to leave that weapons state and go to another one)

    So now... I'm thinking about playables. Mechanim is pretty black boxy, and doesn't support runtime graph changes, so perhaps going down this route could work. Sadly, I'd be reinventing the wheel. I was imagining building a system sort of like ue4's animation system, in which "layers" are replaced with different state machines, which can be blended in however way you want. (instead of a single mask like mechanim). This would allow for all my individual weapon state machines to be present, then essentially create a blend tree to blend them depending on the current weapon being used.

    So. Any thoughts on these issues? Is playables the direction I should go, or am I insane for even thinking about this? Should I just drop the whole issue and just do the traditional "throw everything into a massive animator controller asset"?

    Thanks!
    Josh
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Well ... here's my wheel. It lets you play individual AnimationClips without any extra setup and/or play and blend between multiple regular AnimatorControllers as if they were each a sub-state machine.
     
    joshcamas and Willbkool_FPCS like this.
  3. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,277
    That looks pretty interesting. So you can have multiple animator controllers, does that mean you can have multiple animator controllers per layer?
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Yeah, you can essentially mix and match however you like.
     
    joshcamas likes this.