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

Overriding the timeline output weight

Discussion in 'Timeline' started by solarisn, Mar 8, 2018.

  1. solarisn

    solarisn

    Joined:
    Apr 6, 2016
    Posts:
    13
    Essentially, I'm trying to adjust the output weights that timeline applies to the target output (in this case, an animation). I'm trying to write a playable that will allow me to do programmatic branching of a Timeline's behavior. We have an enormous amount of animation work that is already built using timeline so this is important to allow me to override timeline animation clips using Mecanim during the playback of a timeline.

    Right now, when one of my custom playable clips reaches the first frame, it checks to see if the user has interacted with the character (in this case I am using streaming speech recognition as input from the user). I need to use Timeline because if the user hasn't spoken, I want the timeline to continue to play uninterrupted. In addition, I want to be able to drag my custom clips around to sync up with keyframes in the Timeline animation where it makes sense to naturally allow the character to stop what they're currently doing, blend into a "listening" animation, and wait for the speech recognition final result to animate the appropriate response.

    To do this, I'm essentially branching from using Timeline to using Mechanim if a user is speaking so that I can have more control over interactivity of the character while the user is talking. When the user has finished talking and the character has finished their response animation, ideally I would like to blend back to the animation state that the character is at on the last frame of my custom playable clip so that I can use a single Timeline for the entire interactive narrative experience. I realize this could be difficult (if possible at all) because it requires my custom playable to have awareness of a specific clip on a different track.

    I know I could blend into mechanim just fine if I could adjust the weights output by the Timeline node for different incoming mixers (my mixer and the default mixer for an animation track). I would perform the blend by adjusting these weights over a period of time and then calling Pause() on the playable director because the Animator's Playable Graph has now taken control.

    I'm not sure if I'm missing something here as I only started learning about the Playable API yesterday but it seems like this should be possible. Alternatively, because "Override Track"s are a thing - I assume that it would be possible to feed the Mecanim output directly through my custom mixer and then apply weighting there but:
    1) It's not clear to me how I would hook up the Animator's Mecanim output to route through my custom playable (or is it already doing that if the Animator in question is my exposed reference on my custom track?)
    2) Because the Override Track isn't open sourced, I don't know how I would perform the weighting that I need to do a blend.

    Is there a way to manually control the weight that a Timeline applies? Right now you have it set up so that Timeline overrides Mecanim but shouldn't there be a way to do the opposite?

    I really appreciate any help in resolving my issue. I'm super excited by this tool if I can get it to work but need a push in the right direction. Thanks in advance :)

    EDIT: I would really appreciate a relatively quick response. In order for me to continue down the path of utilizing the Playable API I need to know if it's viable pretty much immediately otherwise I need to switch focus right away because we have a tight deadline. I know it is a lot to process so I wouldn't mind a half-baked initial response telling me whether it's doable (followed up with some elaboration when you have some time to think about it). Thanks!
     
    Last edited: Mar 8, 2018
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
  3. solarisn

    solarisn

    Joined:
    Apr 6, 2016
    Posts:
    13
    Wow this looks great! It seems like exactly what I need. Another question - is there any plan to open source the built-in playable track types? I'd love to start extending some more of them but it would be a lot easier to do if I had the basis to build on. Because they're built on top of the Playables API, there shouldn't be any issues with proprietary IP, correct?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Yes, we are planning to move timeline to Unity's package system. This would mean the source would be available.
     
  5. solarisn

    solarisn

    Joined:
    Apr 6, 2016
    Posts:
    13
    Can I override the Playable Director? Are there two classes called PlayableDirector? It doesn't seem to be a Monobehaviour so I can't add my inherited version as a Component.
     
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    No, PlayableDirector isn't overridable. It's a built-in Unity component (like animator, renderer). That being said, I don't think there is anything that it is doing that couldn't be done in a monobehaviour. It uses the playable API (and PlayableAsset API).