Smoothly Change FOV When Sprinting In UE5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone interested will create this printing effect so when you sprint the fov will smoothly increase so it feels more like fast paced when you sprint so without further Ado let's start the first is to go to the first picture folder blueprint and then I want to go into the BP first projector and then we'll do go into event graph and find the empty spot and now I'm going to create the code for sprinting so if you already have the code for sprinting you don't need to do this so you can just skip this so you can just skip this part but I will just make the code for sprinting quick and if you don't have the code you can follow me as well so so you want to get the left shift key so right click and left shift key because I want to Sprint with the left shift key and now want to drag out the character movement so we get a reference to our character movement and then regular Veer and set max workspeed and then just duplicate that and drag you into the target in the release will go into there and press two will go into there so now when I Sprint I want the max workspeed to be set to 600. and then when I walk I want a Max work speed to be the default workspeed so if you don't know what's the default workspeed is just click on your character movement and you can see here Max workspeed so my Max workspeed is set to 200 so I will set this Max work speed to 200 as well so it's the default workspeed so now the Sprinter code is all done and now let's follow on with the tutorial it's now out of here we want to add a timeline so add a timeline and then just call it change fov just like that and then you will go into the reverse of the timeline so when we walk you want to reverse the timeline so it's going back to the normal fov so now going into the timeline I want to add a track I'm going to add a flow track then just call it Alpha then I'm going to change the length from 5 to let's say about 0.5 and the length is how long it will take to increase the fov when you're sprinting so I want it to be kind of fast so I will set the length to 0.5 seconds but you can set to whichever number you want it's not going to add a key so hold down left shift and then left click and this creates a key now the time will be set to zero and the value will also be set to zero then I want to add another key and the time will be set to point file so it is at the end of the timeline and the value will be set to 1. just like that so now we can click these two icons up here so click these two and this will make it so that it fits to the screen so now as you can see it is a straight line but I want it to be more smooth so I will right click on this key and I'll click on auto as you can see it's created this kind of curve so it's much smoother so now compile and save and go to the event graph so now I want to get a reference to our first project camera because we want to change the field of view inside of the first push camera so drag out the first bit camera just like that so now we have a reference for it and now drag over here and to set field of view because you want to change the field of view when we're sprinting so I'll update retract that in to the set filler View and then out of here go to lerp and the alpha will go into Alpha of the timeline now lerp is that it will change between these two values when you sprint and work so the a value is the default value for the fov so if you don't know the default value for your field of view you can just click on the first page camera and as you can see in my field of view is set to 90 for the default so the a value will also be set to 90. because it is the default field of view [Music] and now when I Sprint I want the field of view to increase so the B value will be set to let's say about a hundred and ten so now when we Sprint the field of view will change to 110 so we will increase the Field view when we're sprinting to simulate a kind of fast moving effect so yeah that's the code done and let's compile and save and see if it works so now as you can see it will work it is the default fov but if we Sprint it smoothly increases and if you work again it smoothly decreases to the default of it but there's one issue if you stand still and hold on shift you can see that the fov increases so let's fix that right now because we only want fov to increase when we're running so let's fix that right now so first of all we want to get the W key so right click and search for the W key this one right there and then I want to create a new variable so click on this ad right here and call it can Sprint because we only want to Sprint when we're working so drag out can Sprint into a pressed and then just duplicate that and drag it into the released just like that snow depressed is can Sprint is of course true so check the box to true unpressed and here the release will be on false because we can't Sprint so now go down to the sprinting code and then just drag you out a little bit then you want to hold down B and left click to create a branch now just duplicate that and release you're going to there and you will go into there just like that so the condition of these two Branch will be the can Sprint so drag the can Sprint to the condition of the branch just like that so now when we press left shift we are checking if we can Sprint and if we can Sprint so it is true you want to follow one with decoder just like that and the same here if we release the lift shift and we can Sprint so it is true we want to follow one with the code so now it should be working so let's compile our save and test it out so now if I walk the field of view is the default but if I Sprint you can see that the field of view increases and it increases smoothly so it isn't Snappy so yeah that's all I hope you like it and I'm sorry that I haven't been uploading in a while I'm very sure about that I will start to upload more I swear I promise so don't worry about that but yeah that's all if you like it and if you have any questions just type it them in the comments and also join our Discord we have a big community over there and it is very nice to see you guys join the Discord so yeah that's all I hope you like it and yeah bye
Info
Channel: Eremental Studios
Views: 6,551
Rating: undefined out of 5
Keywords:
Id: nng3P3oYpI8
Channel Id: undefined
Length: 7min 28sec (448 seconds)
Published: Mon Jul 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.