Smooth FOV during sprint

How can I change the FOV when sprinting?

Most tutorials just set a static FOV during sprint, but because it’s a magic number it’s going to break if you change the FOV later.

I’ve fixed that by adding a getFOV + 10 instead, but now it’s an instant switch when the run key is pressed.

How can I add / subtract to the FOV while also keeping a smooth transition between the states?

you can you add a timeline inside an actor that does that effect. A typical setup would look like this:

Well, I’m not sure if the video @L.F.A posted talks about it, but that’s kind of where constructors come in handy. Setting two parameters, StartFOV (just set that to get field of view and then your target to be StartFOV + 10, or whatever floats your boat) And then as suggested in the video, use a timeline tied to a lerp node to move between the StartFOV and TargetFOV (your StartFOV + 10) when toggling the sprinting state. Make sure the StartFOV is set in the constructor though, as that ensures it is set before the actor begins play so you don’t rely on magic numbers and don’t have weird FOV clips.

Another alternative to timelines in LerpTo which allows you to set a current, and target, and doing it like that almost lets you make a state machine sort of thing so you could run an enumeration selector for slow walk, walk, and sprint or something of the like and plug the target FOV difference (slow walk could be -5, walk would be 0, and run 10) and add that difference to the StartFOV and make that the LerpTo target, it’s a lot less static than timelines but it does require ticking of some sort to set the FOV, so it might not be as performance friendly, though I’m sure you could link a timeline to that too just for the ticks across a set timespan, might be janky though.

Let me know if you have any questions or would like a demonstration of one of the methods and I’ll put one together!