Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Modular animation

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

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    321
    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. SilentSin

    SilentSin

    Joined:
    Jan 3, 2013
    Posts:
    101
    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:
    321
    That looks pretty interesting. So you can have multiple animator controllers, does that mean you can have multiple animator controllers per layer?
     
  4. SilentSin

    SilentSin

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