Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Dynamic bind transform in Transform Tween Track dont work

Discussion in 'Timeline' started by wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs, Mar 26, 2024.

  1. wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs

    wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs

    Joined:
    Feb 8, 2024
    Posts:
    5
    I've tried to implement a forced displacement of a specific object with a Transform Tween Track. I play the prefab's Transform Tween Track gameobject in the scene moving normally, but it doesn't work when I try to dynamically assign startLocation and endLocation via script, I checked the clip and it shows that both startLocation and endLocation are correctly assigned, but the gameobject is not moving.
    I don't think it's an issue with the animator because it was tested on an object that didn't have the animator component and it didn't move either
     
    Last edited: Mar 27, 2024
  2. wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs

    wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs

    Joined:
    Feb 8, 2024
    Posts:
    5
  3. tsukimi

    tsukimi

    Joined:
    Dec 10, 2014
    Posts:
    84
    > but it doesn't work when I try to dynamically assign startLocation and endLocation via script

    Did you play before you assign?
    To explain, every track/clip has an runtime form (called Playable), which is created when you play the PlayableDirector. The runtime form contains all infomrations (in this case, the start/end location) and won't update since. Hence, you have to assign the start/end location before you play your PlayableDirector.

    reference: Timeline Transform Tween Track Sample
     
    Last edited: Mar 27, 2024
  4. wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs

    wechat_os_Qy02mKtV9Fn2q0k_jGa7yGmIs

    Joined:
    Feb 8, 2024
    Posts:
    5
    upload_2024-3-29_10-34-21.png
    I called director.play after assigning the tracks, and actually the timeline asset I set up had three tracks, the playable scipt track and the anmation track both worked well
    upload_2024-3-29_10-29-25.png
    The actual effect is as shown in the figure, the person on the right in the picture is the object bound to the transform track I set, and the coordinate system on the left side of the picture is the endpostion I specified, but it does not move during the actual operation
    upload_2024-3-29_10-33-22.png
     
    tsukimi likes this.
  5. tsukimi

    tsukimi

    Joined:
    Dec 10, 2014
    Posts:
    84
    I'm not sure where the problem is, it seems should work.
    I did a simple experiment that is similar to your setup (assign startLoc and endLoc at runtime), and it did moved.
    Maybe you can test in an independent scene, with only simple Tranforms, so that you can find where the problem is.