Cropout Sample Project - Unreal 5.5.4 - Mega Learning Thread

[INFO DUMP: BP_Player / Continues]

Time flies, eh, but I am not giving up yet, as did things in the background, while getting used to the new job. Anyhoo…

[IA_Zoom / Update Zoom / Depth of Field]

Understanding the zooming part of the code took a while as many of the variables were not named and just set as numbers so had to disect the nodes one by one until I have figured out how to even name the things, and still, for some it feels so clunky.

IA_Zoom is based on Axis1D which to me means that the values can be either positive or negative and thus whatever direction the Mouse Wheel moves to, we will store it inside Zoom Direction. Aside from that, we will need some form of multiplier to account for how quickly we want to zoom in and out, and that will depend on Zoom Direction Speed Factor, not the best name but for me it works, choose whatever makes sense for you.

We have direction and speed factor, now we need the bounds. As per the original creators we need to define and store the Zoom Height or, in other words, the highest the camera can go. We do so by clamping two values, the Zoom Height Max Factor which is the top point and Zoom Height Min Factor which is the lowest point. In my case it’s 0.25, as considering the Zoom Direction the values are clamped between 0 and 1. And as we move, the Zoom Height is added to the Zoom Direction multiplied by the Zoom Direction Speed Factor. This way we have the direction, speed and distance sorted for the most part.

Then comes the Zoom Curve to make the movement less linear, based on a simple float curve stored in the C_Zoom asset, which then is converted into a float by calculating Zoom Height in time? That’s how I understand it.

The Zoom Curve Float feeds into Alpha used to define the clamping points of the Target Arm Length. For that we needed to have the Zoom Arm Length Min Factor (800) and Zoom Arm Length Max Factor (40000) which feel to me like boundaries for the arm to lag behind in case of rotations and other manipulations.

One thing here that took me a while to understand, even though it feels so obvious, is the Set Node with Target, which simply is a special case for how you would set a variable for a component within the root of the Blueprint. Good to know it now.

Spring Arm component has also its relative rotation which we need to set for the zoom to be functional in this case. We care only about the Rotation Y (Pitch) which to put it simply is the up and down movement. Zoom Rotation Min Factor adn Zoom Rotation Max Factor, despite floats still, had to be seen as degrees as what we want to achieve here is to limit the movement to a certain angle, preventing the camera from zooming incorrectly.

Here we define the Max Speed as part of the Floating Pawn Movement Component, which to my understanding defines the movement of the Player, which owns the camera on the Spring Arm. Zoom Speed Min Factor and Zoom Speed Max Factor are nothing more than clamping points to not allow for crazy acceleration or frozen movement. Alpha again is fed from the Zoom Curve float convertion.

Then we set the Depth of Field which is way smaller function, mainly to define the bluriness, I guess, of the camera lens.

One thing of caution I have encountered is, if I break the links with the Make Post Process Settings, sometimes the options turn grey and linking it back is quite tricky.

Finally, we define the Field of View needed by the Camera component. Again, we had to set the clamping points via Zoom Field Of View Min Factor and Zoom Field Of View Max Factor, tweaking which makes the camera more or less focused. Alpha in this case as well is fed from the Zoom Curve float convertion.

And that’s it. I hope it helps in making your own camera zoom based on what was available in the Cropout Project.

More BP_Player functions and macros to come as that BP is the biggest of them all. :slight_smile: