Jerky Unity Spline movement (From Package)

Hey guys,

There seems to be some erratic SplineAnimate behaviour with certain camera angles.

I’ve been implementing a racing game that utilizes Unity’s SplineAnimates and SplineContainer. There are multiple cameras throughout the race of two types: LookAt, and Follow.

The follow camera simply latches to the racer via child/parent relations or the parent constraint. For profile shots with this follow camera, you can see the SplineAnimates behind the followed racer move sporadically.

I’ve updated the spline package, I’ve implemented my own SplineAnimate movement with the container, and I’ve tried the exact same SplineAnimate movement source with some modifications and the jerkiness still happens which leads me to believe there might be an issue with the PositionEvaluation from SplineContainer.

Please refer to this uploaded video:
s5g52m

In the video, I used a simple straight spline with SplineAnimates, parented the camera, and offset the movement speeds. You will clearly see the racers that fall behind start to jerk erratically. I then disable the splineAnimates and implemented an incredibly simple movement script with offsets again, and you can see there is no jerky movement.

If anyone knows how to tackle this issue or point out mistakes from my end that would be greatly appreciated.

Thanks,
Martin.

The term “erratic” makes me think maybe you’re mixing Update() and FixedUpdate() for movement and camera update.

Here is some timing diagram help:

Here is an abbreviated and better-annotated version of the above:

Two good discussions on Update() vs FixedUpdate() timing:

You MAY also wish to get out of the camera wrangling business!! Camera stuff is pretty tricky… you may wish to consider using Cinemachine from the Unity Package Manager.

There’s even a dedicated forum: Unity Engine - Unity Discussions

I appreciate the effort you took to respond. Please note that in the video, I’m using Unity’s “SplineAnimate” component. The jerky movement isn’t handled by any of my scripts, but Unity’s. I’m pointing out an issue Unity’s spline package has, and I’m looking for a way to work around it or to edit the source code to work for me.

I’m sure Unity’s dev team is aware of the differences between their update loops :wink:

I’ve used Cinemachine, and sure it’s good, but just for a follow and lookAt camera, that is very much overkill. There is no problem with my lookAt and Follow scripts, heck even Unity’s “ParentConstraint” component works the exact same way as my FollowScript. Those camera mechanics are easy to handle and not the issue.

In fact, I’m almost certain the issue isn’t with the SplineAnimate component but with the SplineContainer, specifically its evaluation calculations the SplineAnimate utilizes.

Hi @VDiablo
I also have an animation issue with Splines (version 2.4.0).

Contrarily to your issue, though, it works fine in the editor game mode for me.
However, as soon as I export to WebGL the animation gets all jaggy and jerky.

Writing a script myself didn’t change anything. As you mentioned, SplineContainer.Evaluate seems to be broken somewhere, at least in WebGL export.

Did you find a solution in the meantime? Did you find an alternative for splines that works?

Thanks and cheers,
F