Search Unity

Any example of how to make custom Anim and Anim controller tracks for timeline?

Discussion in 'Timeline' started by manuel_rochon, Aug 31, 2017.

  1. manuel_rochon

    manuel_rochon

    Joined:
    Nov 9, 2015
    Posts:
    23
    Hi guys,
    are there any examples somewhere of how to make custom Anim and Anim controller tracks for timeline?
    I watched James Bouckley's vid on Youtube and downloaded the default playables a couple of weeks, I also read PP's blogs and the Timelines and playables docs and examples, but none of these give examples for doing those more advanced types of tracks.
    Creating playable graphs for anim clips and anim controllers is super easy, but when it comes to making the equivalent as custom tracks for Timeline, its really not obvious. A lot of code is hidden from us, and it's hard to find where to plug our code in the 4 scripts we need to create for custom tracks.
    I tried for days without success. I was able to make a graph that seems connected properly when looking in the graph visualizer from github, but it doesn't play on the Timeline.
    Maybe what we are trying to do is just not possible yet?

    Any full examples or code snippets that could point us in the right direction would be greatly appreciated.
    Thanks!

    Manuel
     
  2. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    In your custom playables, are methods like OnBehaviourPlay or PrepareFrame called when you play the timeline? If your graph is properly connected, they should be called.

    If those methods are called, make sure the time is advancing on your playables when you play the timeline. To verify that, play the timeline, then click on a node in the graph visualizer. The current time of the playable should increase. If time is not increasing, maybe this is your problem. When creating a playable, set SetPropagateSetTime to true. This will ensure that the current time is propagated to a playable's children.
     
  3. manuel_rochon

    manuel_rochon

    Joined:
    Nov 9, 2015
    Posts:
    23
    Hi Julien,
    yes the both methods are called, and time is advancing on all the playables. SetPropagateSetTime is set to true on them too.
    But to be frank I have not clue if I'm building stuff properly and plugging it in the rights methods of the four scripts.

    Isn't there any example for custom anim and anim controller tracks anywhere?
    I'm sure it would take you guys less than an hour to build those samples, instead of days or weeks for us. ;)

    Thanks for the help!
     
  4. manuel_rochon

    manuel_rochon

    Joined:
    Nov 9, 2015
    Posts:
    23
    oh well, I guess we won't be using Timeline for a while. We'll stick with old tools until its more stable and more code examples are provided.
    Can't believe it's that hard to provide us with some examples.
    Thanks anyways!
     
  5. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    Hi Manuel

    We don't have any examples for custom animation track or animation controller tracks.

    The Timeline AnimationTrack uses a lot of internal methods, so trying to replicate that in a custom track will be difficult. Could you provide more details about what you want to do? If I can know more about your use case, I will be able to help you and maybe even make you adopt Timeline ;)
     
  6. manuel_rochon

    manuel_rochon

    Joined:
    Nov 9, 2015
    Posts:
    23
    A new answer, nice!

    We want to be able to make our own anim and anim controller tracks, because it will be useful with our complicated, hi-rez and heavy assets and systems. We make VR experiences with hyper realistic characters and environments, with both body and facial animation, of the highest quality you can imagine in the industry. (Thrust me, dealing with Unity for all that stuff is not always easy)

    Custom Anim Track: one reason is because we can't control the avatar mask right now. I know it's coming, but I'm sure we will have other needs in the future, and knowing how to do it will be useful.

    Custom anim controller track: This is the most important one. There doesn't seem to be a track like that in Timeline. Basically we want to be able to mix between different anim controllers, and between the one that's already on a character animator, and the ones on the track. This will be very useful when using complex anim controllers with multiple layers, for example.

    Making 2 anims or 2 anim controllers blend with playables is super easy, so we thought that developing such custom tracks for Timeline wouldn't be very hard either. I guess we were wrong.

    We don't need any fancy examples with all the UI crap, we just need to to be shown how to make it work.

    Thanks for any help!
     
  7. silverbackAlex

    silverbackAlex

    Joined:
    Dec 5, 2016
    Posts:
    1
    Hi, apologies for resurrecting an old thread, but has anyone made progress in this area? I have been working extensively with timeline for a few months, and have encountered an obstacle along very similar lines to those described by Manuel.

    I need a custom timeline track that partially recreates the functionality of the default animation track; a track whose clips can blend animations and apply the result to an Animator (using an Animator as the track binding, and an AnimationClip as a behaviour variable). Even the most rudimentary example of mixing animations within the MixerBehaviour of a custom track, and applying them to a target Animator, would be amazingly helpful.

    The purpose behind such a clip is to insert custom behaviour between mixing animation clips and applying them to the animator, or influence the mixing of animations based on an external factor.

    One example is character locomotion; a lot of our projects involve lots of characters walking between many locations. In Timeline, this currently involves a lot of editing and tedious work with clip offsets; all of which has to be done by hand for each pairing of character and destination, and re-done any time a target location changes.

    It would be great to create a custom clip with an optional target transform; which played a walk cycle normally, but also oriented the animation each frame so that its root motion carried it toward the target.

    Timeline has been an invaluable tool for our team; and an in-house rule is that we don't employ animation tools (in our cinematic experiences) that won't preview correctly in Timeline; this allows our directors and designers to employ film editing and storyboarding techniques more directly to the experience, and allows us to choreograph entire scenes rapidly, using only Timeline.

    This philosophy has proved essential - and I've written some excellent custom tracks for animating things like Blend Shapes and constraint targets - but its current failing is the inability to "intercept" animation on its way to the character, in order to tweak it based on something dynamic. Right now, entire timelines directing the movement of characters can become obsolete due to design or environment changes; things quickly become difficult to maintain or update in bulk.

    With something like the above example, we could animate characters in timeline, but direct their movement via waypoints.

    I've experimented with various Timeline hybrids, like using Timeline to send commands to a NavMeshAgent, or to a MonoBehaviour that tweaks animated transforms directly in LateUpdate; but these methods either violate the aforementioned preview rule, or become unreliable due to the varying playback state of Timeline.

    Any input or example would be incredibly helpful, thanks for your time!
     
    Marrlie and Cleverlie like this.
  8. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219

    hey @silverbackAlex have you found any solution to this?? it's the exact same issue I'm having right now, to make a single character move you have to blend dozens of clips of walk->idle-walk->run->walk etc etc and mess around with the offset positions and rotations, it is reaaally tedious and unefficient to work this way, I was thinking on creating a custom track that makes the character follow a spline and apply a sort of blend tree just like mecanim does, depending on the velocity of the movement blending between idle-walk-run automatically, this would speed 100x times our animation production, such a shame we can't make something like this by ourselves, I've been creating several custom tracks to deal with other stuff, but nothing that modifies animators, @julienb do you think you can give us a hand here?
     
  9. JerrodStorm

    JerrodStorm

    Joined:
    Dec 13, 2018
    Posts:
    4
    I see I am not the only person to run into this type of issue with timeline. :)

    For me, it's nothing as complicated as what silverback, cleverlie, and Manuel ran into.

    I have a custom player script that's driven through a finite state machine framework I built. I'd like to be able to make a track that drives it with state change clips, so that it's still up to date when exiting a cutscene and the animator controller that stores the animations doesn't get all bent out of shape. It'd be extremely convenient if I could combine the track's functionality with the typical animation track to get position/rotation, etc keys going.