Search Unity

Animating and Sequencing by Proxy

Discussion in 'Timeline' started by CDF, Feb 7, 2019.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Hi, So recently started using Timeline and have hit a little workflow problem.

    To put it simply:
    I have a Timeline with a bunch of Cinemacine cameras and custom playables.
    These cameras and playables need to reference game play objects.
    Game play objects are not available until runtime and might only exist briefly based on game play events (e.g spawning an enemy)

    So how to construct a Cinematic sequence where the objects involved don't actually exist until specific moments in live game play?

    Basically, I need to be able to reference some objects in order to compose the sequence at edit time.
    From all the videos and all the tutorials on Timeline, all objects involved in a sequence always exist in the Scene at edit time.

    How have people been creating their Cinematics without being able to reference game play objects?

    The solution, it would seem, is to use proxy objects. An object that can be referenced at edit time by Virtual cameras etc, then deleted at play time.

    The issue here, is that these proxy objects have no idea what is referencing them, so a lot of manual code must be written that looks at potential components on a Timeline that might be referencing them, then if found, replace that reference with the desired game play object. (Not talking about Track Bindings here). e.g Replacing what a Virtual Camera "lookAt" target is.

    The other option I assume, is to keep the proxy objects, and instead of searching for references, just position and orient the proxy to the game play object. (I don't believe you can re-parent because of "Exposed Reference" but might be wrong here). The issue here, is now each proxy needs some Update method. But the execution order may differ from the game play object, potentially creating a discrepancy. There might also be issues of Update type, where the game play object has a rigidbody but the proxy does not. Causing Cinemachine to not update correctly.

    And finally, maybe this just isn't something you should do? Maybe I should always strive to have every game play object available at edit time, so I can reference them without all this hassle.
    That is quite the mandate though. Considering that games aren't so rigid. Objects are always being spawned, destroyed, loaded, unloaded etc.

    Anyway, maybe there's a solution to this problem that I'm just not seeing. Some cool feature of Timeline I've missed.

    Thanks for reading
     
  2. david-wtf

    david-wtf

    Joined:
    Sep 30, 2021
    Posts:
    25
    Hi @CDF Did you ever come up with a satisfactory solution to your question? I'm in the same situation right now, and wonder how to best proxy property animations to runtime-generated objects. Or did you end up with a completely different solution?
     
  3. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    I would love to know too!

    If I was going to try something, I like the idea of the proxy object, then add a script to the proxy object to follow a runtime game object (if it exists). (There is a reparenting constraint in the Animation Rigging package as well that might work to do this tracking.)

    So you have an empty game object that is not visible that you track cameras etc to, then that game object has a script that follows the "real" game objects when they exist (e.g. look for it via labels or something). Could lerp the proxy object to where the real object is a bit smoothly to avoid whiplash. But I have never actually tried it.