I could use some help dealing with spline distance precision issues. From my research, it appears that using distance based functions for the spline component like Get Location at Distance Along Spline result in precision issues.
Video example In this video, notice how the prior and following rail cars jitter forwards and backwards. This is a precision issue caused when tangents are used and spline point types are not set to linear. When the point types are linear, there is no jittering.
From my research, it appears that using distance based functions for the spline component like Get Location at Distance Along Spline result in precision issues.
A lot of video game stuff is smoke & mirrors + good-enough approximation, sure. I’ve never ever experienced anything like this with splines, though. Might be wrong but I’d blame the movement method / something else than sheer lack of precision. Not at this scale and scope.
Could you replicate it with a single car and / or explain the movement method?
ApplyWheels is not relevant since it only effects some scene components and doesn’t touch the Actor’s position. IncrementPosition just increases the cached distance float using a speed and world delta seconds.
The only func to pay attention to is ApplyPosition. But inside, it’s extremely simple. Most of what you’re seeing is just some debug stuff set up for logging. The core of it is just getting the location from the spline using distance and then setting actor location and rotation. That’s it.
I understand in theory that the rate of change shouldn’t be totally constant (to account for framerate), but there is a discrepancy between the units of distance changed vs real world v3 change. It’s small, but it adds up I feel. I think that’s the source of the jitter.
I hope that added more useful context. I’d be happy to clarify more if you’d like
How does Correct Rotator work with the pivot of the mesh. Where is the pivot?
I think that’s the source of the jitter.
I don’t buy it (yet!), your jitter is in 10s uus, not .01.
Here’s what I’m getting at: in order to figure it out, we’d need a reliable way of replicating it. All I get is a buttery smooth (on my end - not in the compressed anim) progress under regular circumstances:
So I must question the irregular. I also tested the above at 1 million uus from world origin. Also made the spline a couple million uus long - here you can tell the interpolation is lacking when you spread spline points over great distances. The movement is still smooth though, you just can feel the angles.
The pivot is the center of the mesh at the bottom.
Correct Rotator flattens the Z and will rotate it 180 if the train is going in reverse (Direction is 1 or -1). Although, the Direction shouldn’t affect anything here since in the sample I tested Direction was 1.
Finally, I ran the test once more, but this time, I had the spline’s points set to linear. I believe having a tangent causes greater inaccuracies. This was the result:
I would be more then happy to be wrong about this! XD
Could you try the test you did once more, but this time, have another cube that is ahead and one cube that is before? Then, place the character so that it stands on one of the traveling cubes so the camera is synced to the cube. Do the prior and following cubes still appear smooth?
Tried without the rotator macro. No change. Once again, I was able to visibly observe the jittery motion when I stood on the ramp of one rail car and looked at the prior/next cars. When the spline was linear, it moved perfectly smooth. When I added back in the tangent/curve point types, it reintroduced the jitter.
I think it’s definitely something that’s harder to observe when your player character isn’t standing on top of one of the moving objects.
So, there’s no jitter if you do no board the train?
There may be something there, but that’d be an issue with the CMC perhaps? I wonder if the observed result is due to the inconsistency of spline point distribution. You could try rewriting it using this instead:
I believe it’s still visible - but it’s much harder to observe/quantify when not aboard. It’s certainly harder to observe. When I run to match the speed of the train, the jitters become easy to spot.
Oh! Sorry. I missed your edit before I responded. I’ll give that a try! Im going to bed soon, but I’ll try some of your ideas tomorrow. Thank you for your help!
Thanks so much for sending that project link over. I loaded into that environment and tweaked some values, and I’m able to see that jittering in your example.
This video was recorded with a spline duration of 5, Speed of .35, and spacing of 0.1. Although, you can achieve these results without changing the spline duration but just reducing the spacing. I know the jitters may look minor, but they add up when the scale is large and you’re dealing with train-sized objects.
Here is the test once again, but all the point types are linear instead of curved. No jitter.
Finally, here it is one last time with increased point density. I’d argue the jitter is basically invisible at this point.
I think my takeaway is that the jitter is most noticeable when…
Spline runners are near each other
The player is traveling at the same speed as another spline runner
Spline points are not linear
Non-linear spline points are separated by large distances. Increasing point density seems to improve accuracy
WAIT! What is this magical slider? I tried turning it up all the way to 100, to the max, and now everything looks totally smooth! What’s going on here? This is great!!