Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using timeline to manually animate curvy position.
#1
This is a great asset for creating spline and animate object along them, however when using curvy combined with Unity Timeline and Cinemachine, when the object position is updated via timeline key frame along the spline, the cinemachine camera is never smooth when the timeline is played. 

Suspecting manually update the object's position via timeline has a bit of delay. Does anyone find a work around? Thanks in advance.
Reply
#2
Hi,
Do you have a simple reproduction project/scene to share with me so I can analyze properly this situation?
Thanks
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(12-19-2018, 11:07 AM)_Aka_ Wrote: Hi,
Do you have a simple reproduction project/scene to share with me so I can analyze properly this situation?
Thanks

Here is the scene:

Google Drive Link

It has a cube that follows the spline with key framed spline position and a cube that does simple unity position key framed animation, both followed by a cinemachine camera.

Noticed the jittery motion in the first cube, which seems gets worse when played in timeline mode.

Update: I do noticed that this jittery motion is gone when setting the spline controller mode to Late Update + use cache, any other mode will still result in the jittery.
Reply
#4
Thanks. I will keep you updated
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
Ok, I found an explanation for the issue, and have a solution for you

The explanation:

It all boils down to a difference in the frame rate at which the object moves vs the one at which the camera is updated. When these two rates are irregular, you will notice in some frames that the camera moved but not the object, which creates the jittering feeling.
You need to know that when you edit the "Position" property through an animation, the object does not actually move until the SplineController script is updated. The update happens in Play mode at the method specified by the "Update In" field, and in edit mode it happens when Unity's callback "EditorApplication.update" is triggered

To better explain the issue, I will subdivide the issue in two:
  • In play mode: In your project, your controller is updated in Fixed Update. In your project, this means at 50 FPS. The game renders at a different and higher frame rate, so this leads to having situations where the object does not move between two rendering frames, which creates the jittering. Like you found yourself, setting the object to move in Late Update solves the issue. Setting Use Cache to true does not influence that, at least in my experience.
  • In edit mode (timeline preview): this is where the issue is the worst. This is because Unity triggers EditorApplication.update at a very irregular rate.

The solution:
  • In play mode: you found the solution already
  • In edit mode: make the controller update more frequently. There is surely a smart way to do it, which I will try to include in the next update, but for now, here is the overkill solution: Update whenever possible. I will send you via PM a modified version of the controller, that don't have the "Update In" field, and instead updates all the time.
I hope this helped

Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
(12-20-2018, 12:30 PM)_Aka_ Wrote: Ok, I found an explanation for the issue, and have a solution for you

The explanation:

It all boils down to a difference in the frame rate at which the object moves vs the one at which the camera is updated. When these two rates are irregular, you will notice in some frames that the camera moved but not the object, which creates the jittering feeling.
You need to know that when you edit the "Position" property through an animation, the object does not actually move until the SplineController script is updated. The update happens in Play mode at the method specified by the "Update In" field, and in edit mode it happens when Unity's callback "EditorApplication.update" is triggered

To better explain the issue, I will subdivide the issue in two:
  • In play mode: In your project, your controller is updated in Fixed Update. In your project, this means at 50 FPS. The game renders at a different and higher frame rate, so this leads to having situations where the object does not move between two rendering frames, which creates the jittering. Like you found yourself, setting the object to move in Late Update solves the issue. Setting Use Cache to true does not influence that, at least in my experience.
  • In edit mode (timeline preview): this is where the issue is the worst. This is because Unity triggers EditorApplication.update at a very irregular rate.

The solution:
  • In play mode: you found the solution already
  • In edit mode: make the controller update more frequently. There is surely a smart way to do it, which I will try to include in the next update, but for now, here is the overkill solution: Update whenever possible. I will send you via PM a modified version of the controller, that don't have the "Update In" field, and instead updates all the time.
I hope this helped

Have a nice day

Thanks a lot! I will take a look at the controller, really appreciate for the quick and detailed response!  Heart
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  UI button to start Curvy Spline in scene funkd 1 23 07-12-2019, 11:19 AM
Last Post: _Aka_
  Import Curvy from json Issue mlndb10wN 5 301 05-29-2019, 06:46 PM
Last Post: _Aka_
  Spline Controller Position Force Update ? UsernameHed 1 172 05-16-2019, 12:20 PM
Last Post: _Aka_
  Curvy Coppy all points of a Spline Into Another UsernameHed 3 302 05-13-2019, 11:37 AM
Last Post: _Aka_

Forum Jump: