Search Unity

Playable Director - Updating Physics from Timeline

Discussion in 'Timeline' started by edwon, Oct 30, 2017.

  1. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    I'm controlling a physics based character from the timeline.

    I'm using custom playables and I'd like to have ProcessFrame called at the same time as FixedUpdate.

    How can I set PlayableDirector's update mode to FixedUpdate?

    And/or how do I use the Manual update mode and then tick it from FixedUpdate? The documentation on this is unclear: https://docs.unity3d.com/ScriptReference/Playables.DirectorUpdateMode.html
     
    ModLunar likes this.
  2. pierrepaul

    pierrepaul

    Unity Technologies

    Joined:
    Jun 19, 2012
    Posts:
    162
    Hi.

    We currently dont have any API for this. We are looking into allowing users to set when the PrepareFrame is called.

    What is your use case for ProcessFrame ? Id like more details.

    thanks.
     
  3. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    I'd like to do things like Rigidbody.AddForce from inside process frame, because my character uses a lot of procedural physics to animate it.
     
  4. kurzemnieks

    kurzemnieks

    Joined:
    Nov 22, 2012
    Posts:
    16
    I think my use case might be related - I need to call ProcessFrame on LateUpdate. My custom playable in timeline acts as a constraint - transforming child object along skeletal joint. Currently this happens with a delay of one frame.
     
  5. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    108
    This is really important to support! We also need access to LateUpdate, in order to blend bone translations (jaw bone) to match up to defined vowels (lipsync poses) we've defined. Also needed for procedural animation like mentioned before.
     
    ModLunar likes this.
  6. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    I still want this, sounds like others do as well. @pierrepaul please help!
     
  7. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    108
    @edwon - we solved it for now by having a [ExecuteInEditMode]script with public values that are used in LateUpdate() and/or FixedUpdate(). Then we add a reference to this script in the Playable Behaviour, and assign the values in the Playable MixerBehaviour.
     
  8. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    yeah I did the same thing, works well enough, a little over-complicated tho
     
    ModLunar likes this.
  9. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,980
    Any update on this? could really use this! or a workaround?
     
  10. playnaka

    playnaka

    Joined:
    Mar 14, 2018
    Posts:
    1
    Is there any new information regarding this matter?
     
  11. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Sorry, no updates yet.
     
  12. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    282
    +1 on this.
     
  13. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    For optimizing performance for mobile phones, currently there no way to set framerate for Animators.Update and executing it every frame is expensive, because unity retargeting animation happens in runtime unlike Unreal engine where retargeting happens in Editor.
     
    Last edited: Dec 28, 2019
  14. DevinW

    DevinW

    Joined:
    Jun 19, 2014
    Posts:
    37
    Also hoping for an update on this.
     
  15. DevinW

    DevinW

    Joined:
    Jun 19, 2014
    Posts:
    37
    Hoping for something that can just mimic what the Animator's animate physics setting can do.

    https://docs.unity3d.com/ScriptReference/Animation-animatePhysics.html
    ```
    An animated platform can apply velocity and friction to rigid bodies sitting on top of it. In order to use this, animatePhysics must be enabled and animated object must be a kinematic rigid body.
    ```
     
    Last edited: Jun 21, 2020
    ModLunar likes this.
  16. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    This would be great, because as you pointed out
    @seant_unity (in this post), manually calling Evaluate(...) forces the graph to evaluate synchronously, so if we manually call Evaluate(...) during FixedUpdate, we don't get the benefits of having

    "phases split up and run at different points in the PlayerLoop (but all between Update() & LateUpdate()), and threaded as appropriate"