I try to add some camera views to a moving car with FC and DOTween. But the tween goes the last obtained position (position before the tween is started), not the current, moving one. So, if the tween takes 3 seconds, the car already moved 3 seconds away from that position and the camera is never at the spot I wanted it to be.
Any idea for what to look for? Thanks!
Yes. This is how Tweens work in general, in that while they are updated, they tween a Vector3 value from one Vector3 to a target Vector3.
If what I understand you want to do is correct and you want the camera to always “stick” to the randomly selected spot even while the car is moving, bellow is a flowscript that does this for your convenience.
Let me know if you need any details on how/why this is working 🙂
It is a Transform variable ( “Variables/Graph Variable (Transform)” ).
You can easily create such a variable though, by simply drag and drop the gameobject you want from the scene in the canvas and then in the popup that will show, select ( “Transform/Graph Variable (Transform)” )