Jerky horrible movement with CineMachine on a path

I’m trying to make a simple camera follow the player along a path using the ‘dolly track’.
I’ve set the path and camera up, it’s following the object I set, it’s very straightforward, I’m not doing anything unusual, but the camera movement it terrible. As soon as the camera nears a waypoint on the path it jumps ahead along the path by a lot. The camera movement was smooth up to then, but as soon as it gets near a way point it jumps ahead, and then it’s also not in line with the thing it’s meant to be following either. Anyone know why this is and how to fix it?

1 Like

Get the latest here:

Let us know if it’s still happening!

Thanks, but yes it’s exactly the same. Still very jerky movement near waypoints. The camera is also almost never in line with the thing it’s meant to be following, even though it’s set on ‘hard contstraint’ which to me sounds like it should be exactly in line. It’s either way ahead or way behind the target.

The aim or body is set to hard constraint? The body should be set to Tracked Dolly

Try a little Z damping,
Search Radius to 0
Search Resolution up higher.

It’s smooth… if the problem persists, sending over a stripped down example scene will help us debug it.

1 Like

I’ve been trying it in the scene view rather than in play mode, it seems to be slightly better in play mode, i.e. when the game is running, than when I was testing it in the scene view. But it’s still a noticable jump when going between waypoints, particularly when starting a downward slope from a previously flat area.

edit - I think we were replying at the same time :slight_smile: I’ll try those things you mentioned…

Unfortunately still the same. Very jerky and way off the target object :frowning:

Very strange. We need a demo scene to test - if you could send one over we’re happy to diagnose this for you. Or an example video would be great.

Ok thanks, if a video would be be ok that would be a lot easier to make. Where should I send it?

@misterlee could you post a snapshot of the inspector for your jerky vcam? The whole thing please

Sure…

@misterlee There are a three things that I can see off the top:

  1. You’re using Distance units. For Auto-dolly, there is no need for Distance Units, and Path Units have better precision.
  2. Your waypoint tangents are zero or close to it. This hurts your precision when using Distance Units, especially around the waypoints.
  3. Your search resolution is 1. Again, bad for precision. Put it higher, say between 5 and 10.

I would suggest a 4th thing too. Since you’ve upgraded to the latest CM, try replacing the CinemachinePath component with the new CinemachineSmoothPath. You’ll have to re-enter the waypoints, but I think you’ll be pleased with the results. Let me know how it goes.

Thanks for the info. The settings I had in that screenshot were the result of trying to change things to solve the problem that the default settings caused, so I was changing all the settings to see if anything would help. I tried what you suggested, it’s pretty much exactly the same result. Still very jerky movement near waypoints and the camera gets far off from the target in some places along the path.

The smooth path component was actually much worse than the regular one. As well as doing the jerky movement and not being aligned with the target, it was creating it’s own curves to smooth between the points and taking the camera off where I didn’t want it to be.

Having played with the tangent values a bit I’m guessing what it’s doing is to the divide the path into sections and then move the camera from one section to the next, but it’s not making even sections so the movement is not even. There are more sections, closer together where there is a curve and fewer on the straight parts, which makes sense from an optimisation point of view, but not for the smooth movement of the camera. It goes slower on the straight parts and fast on the ‘bends’ because the path is unevenly subdivided, which is probably why it gets further away from the target too. The player (target) is almost off the screen in some places, and it’s only a short section of tunnel I’m trying to walk along.

I did make a video of what’s happening, but of course youtube is as useful as an inflatable dartboard so it doesn’t work. I might try again tomorrow, but I’ve already wasted an entire day with absolutely nothing to show for it.

@misterlee We haven’t seen anything like what you’re describing. I’ll have to see a video, or better yet, a trimmed-down project that shows the problem, if you can manage that.

Ok the video is working now…

I was walking really slow in the video at the start to show how the camera jumps forward, and then you can see it goes far in front of the target. Does that help at all?

Looks like your video is unlisted/private.

I think your video is private… can’t access it.

Sorry! It’s really not my day today is it?! I set it to unlisted, I think you should be able to see it now?

I saw the video (thanks), and I think I might know what’s going on. To be sure, I’d need to see a top-down in the scene view, showing the entire path and the character, but what it looks like is this: I think you might have a concave path around the moving character, which makes it difficult to get a nice motion from the auto-dolly algorithm, which is based on sending the camera to the point on the path that’s closest to the character. As the character walks, he takes a short cut across the arc, and the closest point jumps suddenly from one part of the path to the other, and the camera jumps too.

It’s not about nearness to a waypoint, or about how the path is subdivided, or anything like that - it’s about the shape of the path. As an extreme example, think of your character standing at the exact centre of a circular path. Where is the closest point? If the character sways even slightly, the camera will shoot erratically from one side of the path to the other. So if that’s indeed what’s happening, you need to rethink the shape of your path, or if you really want to keep the concave path, you have to animate the camera position in a different way.

Thanks for the explanation, I’m sure that’s exactly the issue. The tunnel slopes downwards at the start, so yes that section could be considered concave if you’re looking at it from below, but the camera is above so maybe not?

It’s a horizontal movement, so a top down view wouldn’t help, but I made a screenshot to show you…

After doing this I experimented with the location of the path. Originally I put the path where I wanted the camera to be. I tested putting it on the ground where the character walks and adding an offset to the camera. The top of the slope is much smoother, but now the problem occurs at the bottom instead, and the camera is still very much not aligned with the target while on the slope. So that pretty much confirms it has problems with a concave shaped path. So basically this camera path system is only going to be useful for games on a flat surface, in a straight line, which doesn’t seem very useful at all tbh.

Maybe I’ll have to set up two or more separate paths, one on the flat sections, and then one on the slope and have the camera move or blend between them… something like that might work? It seems like a lot of extra effort for what is really a very common scenario in a game environment. Going down a slope must be extremely common in games so I’m sure many people will end up having a similar issue.