Download

[TUTORIAL]Multiple Camera Distances [Blueprint]

Hello everyone, this is my very first tutorial on this awesome forum :slight_smile:

I wan to share some very simple stuff i made playing round

In this tutorial i will show you how to change the distance of the character’s camera while playing.You can also go from third person to first person, of course this is not optimized for first person shooter but you can try tweaking the CameraBoom position to have the best experience possible.

1- Of course for this tutorial you have to add a SpringArm component attached to the root component and a Camera component attached to the SpringArm

7e8a8aab368596624b6e2f3be60ad4ddfdf8998c.png

2-Then add two variables:
Distances: Float, also make it as Array
DistanceIndex: Integer

097be0e2cece8a30697b175f805e671100dffad9.png

3- Add some values to the array, i’ve tested some comfortable distances shown here:

985df3a983c9b525315d48d05000e01d40cc69e4.png

The 300.0 quite a standard distance used in third person template, then i added a very near distance (100.0), a first person vew (0.0) and a very far view (500.0).

4- Lets make go further to the blueprint.

a2830608a3bb8697b5950331243abce4bf3e33c4.png

In this graph i use the Set Target Arm Leght, targeting the Spring Arm, to get the new lenght i get the distance value form Distance Array at the DistanceIndex index, when you start the game it will look at the first index (0) so the 300.0 value.
After updating the Spring Arm lenght i also update the DistanceIndex by addi 1, so the next time you call the function it will chek the next value.
And finally it calls CheckIndex custom function:

Function.png

The function will check if DistanceIndex is bigger than the last index of the array (in this case 3) and, if the value IS bigger it will set 0 again, so next camera setting will be the first distance setting again.

I made this tutorial to store this on the forum in case i need one day and also to share simple stuff with beginner who need help. I hope to improve this time by time by making it better and adding features, but i since i’m studying for University i will try my best to be more active as i can.

Also fell free to share improvements or ask questions, for any grammar errors [COLOR="#FF0000"]PLEASE forgive me as i’m Italian and i’m not very handy writing in english.[/COLOR]

I think you wrote this fine tutorial up rather well. Thanks for your tip, I hope to see many, many more from you in the future.

Welcome to the Unreal Forums.

Thank you very much i will be very happy to share things with everyone :slight_smile:

Why not post it in community content group!!!
Otherwise this thread will be lost .

And thanks for your effort

Thanks for this tutorial!

If a moderator comes in we’ll fix this :slight_smile: