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
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
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
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
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.