Unreal Camera Manager EXPLAINED

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's do something a little fun today let's talk about the camera manager in Unreal Engine so we have an entire camera system which we can use uh a lot of different stuff for we have in the third person character that is PR set up for us we've got this camera boom which helps us doing a lot of very neat and very nice things but we have a built-in camera manager that can do a lot of cool stuff too so today let's just take a quick look at some of the basic stuff that we can do with that first and foremost we're going to do is we're going to make a new blueprint Class come down into all classes and look up camera manager and there we want to make a new blueprint class of player camera manager and we'll call this uh cam M for camera manager uh tutorial now if you have a custom game mode like this one over here you want to come into that game mode you're going to figure out what your player controller is because this is going to require you setting up a custom player controller as well I don't have one at the moment I don't think so let's just make a new blueprint I call that new player controller that's fine and in the player controller we have a bunch of stuff that we can do up top it already says the player manager camera class and there we can select the camera manager tutorial that we've just made so now that player controller is going to use that camera manager and our game mode is set to using that player controller so that's all good now let's go into our camera manager for the tutorial here and we've got a couple of functions to overwrite so most of the functions here are just acto functions but we've got a couple of ones like blueprint update camera this allows you to more or less just override the transform and I believe feel of view of what your camera is currently doing the camera on the player character that is and then there's a couple of things to do with a photograph mode as well which is an entire video in and of itself which I might do in the future uh for now let's just have a little bit of fun with blueprint update camera because this is probably what you're going to be mostly using this for uh we'll set the return value to just always be true just to have this uh be simple and then here we can set the camera field of view the camera rotation and location in any way we want now if you don't do anything with this uh what we're going to see is when we play the game the camera is going to be at 0000 0 because what we're doing is we're overriding the camera's position in our camera manager so uh we can even set this to like let's set this to like 1,000 1,000 1,000 something like that manually and let's also set the camera field of view to 90° so we can actually see anything going on at all and there we will see that right now we're hovering uh right about there which makes uh sense now important to note is that while our camera is hovering here in uh midair if we go into our actual character and into our follow camera uh which is set to a very weird angle at the moment don't mind that uh it's not there so what this is doing is it's not actually changing the physical location of your camera in the world it's just taking the location that you feed into it and rendering from that as if the camera was there that's important because that means that we can use the camera location and add an offset to it without then impacting the camera location with that offset and creating like a recursive weird Loop so let's do that we have this camera Target here which is the actor that this manager is working with it's just a generic actor reference uh so we can uh cast this to our blueprint third person character and from that we can uh get the camera down there and from that we can get the world transform it's important that we do the world transform and not not the uh local transform because this is going to set it in World space which is very useful because that means that if you want to make some more complex logic than we're doing right here your camera can be moving and set to positions independent of your character's own movement which is uh usually quite tricky to do otherwise so let's split the structure pin on the world transform and now let's just put that into there and the same with the rotation so now our camera will just be functioning as a normal camera because it's getting overwritten by the values it already has anyway but if we go into here and we say hey this um location we're going to add another Vector to that uh let's make that Vector like uh Z250 it's going to have the same camera location but just Z250 higher up so we're now looking down at our character a little bit more but the camera boom and the camera itself still function the same way way so this is just using an offset to render our position now since we have this follow camera anyway we can also probably get the field of view there we go and put that into our new camera field of view just to have it match as well and here's where we can start doing some interesting stuff right because we can just get rid of this uh for now what I want to do is I want to make uh a rotator instead we can do that with combined rotators because rotators are a little bit more complex than just normal vectors so you need to have this separate function for it we can put that into there and then the Rotator we can promote to a variable uh so let's call this rotation to add and you might be able to see where we're going with this and if not uh you will in a moment so let's go back into a third person character I already have a f key which is usually the key I use for testing because I never map anything to the F key anyway and when we press this with we're going to run a timeline and on that timeline we're going to get player camera manager which is just a note that the your VAR you with which is very very nice and we'll cast that to our camera manager tutorial realistically speaking we should cast this on begin play so we don't do a dynamic cast every single uh frame while this timeline runs but I don't really care about that right now and now that we have a reference to our camera manager for the tutorial we can set the rotation to add and let's split the structure pin so we have the X Y and Z rotation separately and we're going to lurp between 0 and 360° which is going to make a circle the timeline will uh add a track to for a float and that will be the alpha for our timeline so that we'll start at 0 0 and let's say that it is a 2cond timeline which ends at a value of one we can put that into the alpha and then we can take any of the axes that we want so in this case I think like let's do a barrel roll which is the X rotation uh so let's put this into the X and now when we press the F key our camera should do a barrel roll so F key and there we go let's put this in play from start actually because otherwise it'll only play once uh you can do a lot of interesting stuff with this right uh you can at the same time make something uh like a second flow track here which does other interesting stuff we can uh add a key and we can say this starts at z uh Z then add another key which will be add one one and then we can add yet another key which will be at two and this will be a graph that goes up and down as you can clearly see uh again we can do stuff with this like making this instead of linear interpolation we can make this user interpolation if we do it for this one too it has a little bit of a smoother curve to it and what we can do with this one for instance is just having a little bit of fun uh getting our field of view and adding to that you can see where we're going with this variable soal is field of view to add that's going to be our new camera field of view and again since we're not actually impacting the field of view from the camera component itself we're just adding or subtracting from or to it we can very easily set these kind of things up without worrying about messing up our actual initial settings for our camera we can always easily R it back to that by just setting the values for these to zero so let's uh set field of view to add and we'll use a lurp for that too uh between zero and like minus 35 and this will also while we're doing that barrel roll uh do a zoom in let's make sure to use the actual new track that we made uh for the other Alpha so if the previous example didn't make you motion sick enough uh this is now also going to be zooming in and zooming back out as it does the rule so this might seem a little bit worthless and useless to you right now uh because I'm just having a little bit of fun and playing around with this but of course you can very much use this to make make a system with a couple different camera positions like let's just get rid of uh the timeline and stuff for now because that was just for a little bit of fun uh if we just take this directly and we come back in here and we again make something very similar uh adding a vector to our actual location for the camera so let's make this a variable uh position to add we can then set the position to add and for now what we'll just do is we'll do like a uh flip flop so let's say uh we set this to uh 100 and this to minus 100 and of course you can do much more complex systems with this uh but this is our default camera and then we can say we want the camera there and we want the camera there now and now it's just going to go back and forth between the two of them this is just a basic idea of what you can do with that one function again there's an entire set of functions to deal with a photography mode which I'm not going to go into right now this video is long enough as is that's the camera manager for Unreal Engine it's kind of nice it's fun to play around with and a very big thank you to all of my patreons you can see them on screen right now if you want to help out supporting the channel there's a link Down Below in the description to the patreon page and a special thanks to my cave Digger tier patreons Serge Thomas
Info
Channel: The Game Dev Cave
Views: 1,303
Rating: undefined out of 5
Keywords: unreal camera manager, camera manager, unreal, camera, unreal camera, tutorial, lesson, the gamedev cave
Id: 4D1i6igqR_g
Channel Id: undefined
Length: 10min 54sec (654 seconds)
Published: Wed Mar 13 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.