How to get camera to move smoothly along a track or spline

Hi! First post here ever!

I am trying to get the camera in my game to move smoothly along a “track” to achieve a cinematic scene. To accomplish this I am using a spline and calling GetTransformAtTime() every Tick then applying the resulting transform to the camera. That’s it.
Now the problem - the resulting movement of the camera is not even nearly as smooth as the spline is looking in the editor, instead it slightly jerks left and right and even seems to get stuck for a few frames here and there.

Any suggestion on how to tackle this?

Can you show your code?

Also:

  • how long is the spline? 5 meters or 5 km?
  • is there a springarm?
  • if so, is the collision probe active?


Here is a picture of the level blueprint.

  • LevelIntroCameras is just a length 1 object array of a BP that has a camera in it (only).
  • MoveCameraTo just calls SetViewTargetWithBlend on the player controller with the camera object as actor input.

The spline is 20 meters probably with 5 segments. Can post a video if it helps.

I’m not entirely sure, but if you’re moving the actor, then aren’t you moving the spline at the same time?

1 Like

You had me worried there for a second! However CameraSpline is just a variable of type CameraSplineBP which is an actor with only a spline in it. So, unfortunately not the issue

1 Like

The shots are getting longer here, but now I’m wondering about ‘twists’ on the spline. I can be pretty difficult to get those buggers to lie right. What with the tangents coming in and out of a curve and whatnot.

If that was the case, then the camera is always going to jump in the same place.

You are not wrong, I found that the spline point in the middle of this curve here caused a twitch as you are saying. I managed to fix it by resizing the tangents. However the major issue is still there, that the camera movement feels jerky. What I mean is that even at a steady 50 FPS it feels like I’m looking at 15 FPS because I can see the environment move in a stuttering fashion when I’m in the curve. :confused:

Should I try to build a shipped game package to see if the editor is the issue?

I have a hunch, that it might work better with a timeline. Because then the rate along the curve is constant. The problem with using tick, is you become a victim of changing frame rates, during the movement.

I tried for a few hours more with the spline approach and as I got better with placing the splines I noticed that the stuttering was becoming less of an issue. Also I noticed that I could see stuttering in Unreals own SetViewTargetWithBlend so I am now assuming its an issue with how Unreal presents each frame.

These are some guidelines I made up that anyone can follow to create better camera tracks.

  • Don’t put a spline point in the middle of curves.
  • To make a smooth curve, the tangents of the 2 spline points must touch each other.
  • It’s a good idea to put a straight line after a curve, otherwise future movement angle changes feel unnatural.
3 Likes

Seeing this a year later, but I have been wrestling with the same issues for camera movements. Thanks for these tips!