HowTo: Dolly Zoom in UE4

This passion I got for photography does not come from nowhere there is personal reason but also a technical one: One I played with cameras when I was making simulation I was wondering how all these things work in real life and how they made it possible in Unreal.

The Cinema Camera from Unreal Engine let the user choose a focal length and has many settings similar to a real camera, here, we need to modify the code of the actor a little or make a blueprint to have a Dolly Zoom in your game.

ugly schema

What is a Dolly Zoom: To know what is a dolly zoom: https://youtu.be/zjKNZ1ydE9I?t=20


To perform it we need the camera to move close to the subject while the focal is getting wider and wider. To have a value between 0 and 1 that is redundant I use a cosinus value over the time for the distance and focal length.

y = (cos(x) + 1) / 2 | x: game time
moving the camera between two distances (alpha is the node we get from the cos value)
changing focal between two value (alpha is the node we get from the cos value)

Then you should expect this result: