‫Hello and welcome.
‫In this lecture, we are going to be getting a third person camera set up like so.
‫So when we back into a wall, it is going to keep our character in view and not disappear within the
‫wall.
‫Let's dive in and see how this can be achieved in Unreal.
‫All righty, then.
‫A third person camera.
‫How are we going to do this?
‫Let's go and do this in Blueprint, because there's really no point doing this in C++.
‫It's all configuration.
‫It's really much easier to do with scene components in Blueprint.
‫So let's go to the BP shooter character, open the full blueprint editor so we can see the viewport,
‫so we can see all of the components over on the left.
‫And what we're going to do is add in a little bit of a camera component.
‫So go to add components camera.
‫And the easiest way to get a third person view is and something you probably already knew, just move
‫this camera out and over the right shoulder or left shoulder, whichever way you want to move it back
‫and you can go ahead and have a play.
‫And that's going to be a third person view, simple as, but things are not going to be that simple.
‫For a start.
‫You can see that our control rotation isn't entirely working.
‫It can't go up and down.
‫And but also if I back into a wall, you can see that I'm looking through the wall.
‫That's no good, is it?
‫So let's try and see if we can make this a little bit better.
‫Now, Unreal has a component for this that makes using cameras in this way a lot, a lot better.
‫But before we do that, I want us to go to the camera component and fix that rotation problem so you
‫can go to the camera options and check the pawn use control rotation.
‫And what that's going to do is it's going to rotate the camera using the control rotation.
‫Let's go ahead and hit play and see if that works.
‫Yes, it does rotate, but unfortunately it rotates around the camera.
‫That's not a very third person.
‫Look, you tend to expect it to rotate around that kind of point over the shoulder here so that you
‫can always keep that character within view.
‫Okay.
‫In enough teasing, what we want here is the spring arm component.
‫I'm going to select the capsule component, go to add component because I want this to be a child of
‫the camera component.
‫Add a spring arm in here.
‫For some reason, Unreal is focused on trying to put these components in my character's crotch.
‫Now let's go to the camera and make the camera a child of the spring arm.
‫And I'm going to just reset its location and transform location under the details pane so that when
‫we select the spring arm, you can see that the camera goes on the end of the spring arm.
‫And then what I'm going to do is you could move the camera, but I'll show you why in a second.
‫That's not a good idea.
‫We're going to move the spring arm instead.
‫And because the camera is ID to the spring arm, it's moving with it.
‫We're going to move that to.
‫So there's this point just to the right of my character's mesh, the right of his shoulder, and that's
‫what the camera is going to try and look at.
‫So if we go ahead and hit play now and move, the movement is still not quite right.
‫But we should have fewer problems with the walls.
‫You can see that now I can back into a wall and my camera doesn't go through the wall.
‫That is the functioning of the spring arm itself.
‫So, you know, when I went into camera and I set the use -- control rotation checked that we actually
‫want to uncheck because it's not the camera that we want to rotate, but rather the spring arm.
‫Because you can see that if I use my rotation widget, which I'm going to use E to switch over to my
‫rotation widget, if I were to rotate the spring arm, you can see that I'd get the right sort of rotation.
‫It wouldn't be just the camera looking up and down, because if I select the camera and rotate that,
‫you can see the camera is just looking up and down, which is the behavior we were seeing.
‫We want it pivoting around that spring arm.
‫So what we can do is we can select the spring arm and go to use pawn control rotation on the spring
‫arm itself.
‫Now, if we hit play and we move around, you can see, yes, that is much more like it.
‫That is third person camera at its finest.
‫And you can see that we're able to move into walls and that is no problem whatsoever.
‫So like to run a little experiment as part of your learning here, we're going to try and figure out
‫why not move the camera?
‫Why did we move the spring arm and not the camera to get a third person view?
‫So try moving the camera and not the spring arm and see what happens.
‫See if you can figure out why I did that.
‫Pause the video and have a go.
‫Okay.
‫Welcome back.
‫So let's give this a shot.
‫I have.
‫I'm going to just go ahead and put our spring arm back in its original location just by resetting it
‫and taking the camera instead using the movement widget and bringing that up into a higher location
‫over up and to the left.
‫So the spring arm, you can see the little red line is pointing back here.
‫The camera is up there and to the left go ahead and hit play in this configuration.
‫Let's see if we can figure out.
‫Well, seems to be mostly working the same, doesn't it?
‫Let's go and have a look.
‫Go near an edge of something.
‫And see if we can figure out what's going wrong.
‫There you go.
‫That is exactly an example of why we move the spring on.
‫Now, what's going on here is that that little red line of the spring arm, this one here that was in
‫the clear when we went through this doorway, it was kind of going through here.
‫So it was going through the hallway just fine.
‫The red line was clear.
‫The camera wasn't clear.
‫The camera was up somewhere inside the wall.
‫So what we want to have happen is that this red line needs to be wherever.
‫We need to clear the view for the camera.
‫And that's why we want the camera to always be looking down the red line.
‫So if we reset it and go and have a look at our spring arm, you can see that now the red line is kind
‫of pointing, firing out of the camera to the point of interest, which, as we said, Unreal has got
‫a bit of a interesting point of interest.
‫And in this case, it should be just above the shoulder like this.
‫And that's the point that we're going to want to go and get the camera to focus in on as much as possible.
‫Now, this does have an interesting point, which is that we want to if we wanted to say rotate this
‫spring arm, you can't simply just go ahead and rotate the spring arm.
‫That doesn't work.
‫It seems to want to go straight out backwards.
‫And the reason for this is it's in the settings of the spring arm itself.
‫You can see that there is this socket offset, target offset and the spring arm length.
‫So the length is telling us how long that length is.
‫That's kind of makes sense.
‫But if you want to do a rotation type of thing, then you can use the offsets.
‫There's no real kind of rotation going on here, but rather we're just kind of moving that camera over,
‫using the offsets.
‫And then if you wanted to rotate the camera tool, you could rotate the camera independently so that
‫if it was pointing more in towards the player like so and because we've still got that red line set
‫up in the right way, the camera is going to work.
‫It's going to keep visibility clear towards the player as much as is physically possible.
‫Now, I'm just going to go ahead and tweak this more to my liking.
‫So I'm going to move it a little bit closer to the shoulder here, because if I got the camera coming
‫in, I want it to almost be looking down the barrel of the gun.
‫But then I don't want any rotation on the camera itself.
‫I find that it's not really necessary, but I do want to have a bit of a spring arm offset so that we
‫can get that camera looking over slightly more to the right when we are not near a wall.
‫And as we get near a wall, it's going to look closer and closer to the player's shoulder.
‫Let's play that.
‫See how that feels.
‫So that's looking like I'm a bit too far over to the right here.
‫Let's bring it in again.
‫I think about maybe 60 units would be good like so just to have a nice round number, I'm going to hit
‫play and you can see that's kind of in the right sort of spot for a third person view in my opinion.
‫And if I go up against a wall, you can see it kind of brings me closer into the shoulder so I can still
‫keep an eye on my character.
‫I'm probably going to have a gun barrel.
‫This might need some more tweaking later on when we've got our animations in place and we actually want
‫to be looking down the gun barrel when we zoom in, that's fine.
‫We don't need to do that just yet.
‫So hopefully you have got now a working knowledge of the spring arm and camera and how we can use those
‫two components together to create a third person camera.
‫Now, all of that brings out the fact that our animations are not there.
‫He's just standing in a static a pose.
‫So in the next lecture, we're going to look at adding in those skeletal animations.
‫So you there.