 Alright, so let's go and actually code in all the functionality for our basic follow camera. So let's get right to it and jump over into Unity. Okay, so let's get going with our basic follow camera code now. So I am going to attach the script to the main camera right here, okay? So I'm going to click and track this basic follow script and you'll notice now we actually have the variables that we set up. So what I want to do is set up the target here first and the target is our barbarian character right here. So I'm going to drag that guy into the target or slot basically here inside of the script. Okay, alright, so let's jump back into the code and actually get this thing working. Okay, so what I'm going to do is go back to mono develop here and what I want to do is first set up a private variable in here and now this private variable is going to store the position that we want to get to and I'm having a problem typing O's today. So private and we also need to declare it. So private vector 3. So it's going to store a position in 3D space for us, okay? And so what I want to do is say that the wanted position is equal to the target position, okay, plus the target's forward position. So I want to say m target dot forward times that distance, okay? And now why does that actually work? Alright, so basically what we're doing is we're saying we're getting the forward vector here and let me actually just put a semicolon there so we can actually go back into unity and not get any errors and let's actually figure this out in more visual way. So what are we doing here? So I'm getting that target forward position, right? So that's that blue arrow or the z direction. Now forward is always that z direction on a character or on any object, okay? So if I were to switch to local mode by hitting x on the keyboard, I can see that the arrow is pointing in the forward direction of the character. Now this is very important when you're setting up your assets or your 3D models. It's a good idea to always have your models pointing in that forward z position, okay? So let's jump back into the code. So you'll notice then I put a negative symbol and that just means that I'm negating this forward direction, all right? So now instead of it pointing forward, that vector is going to be pointing backwards, okay? Cool. And then what we do is we multiply it by this distance value because we could multiply a vector by a scalar or a float, okay? But they're the same thing, okay? We're going to multiply that back 10 units, okay? Because the target forward value is always a value of one. So it's one unit pointing out in the direction that you've specified. So now by multiplying it by 10, we push it all the way out. So now we're down on the ground here. So let's actually just see what that does. So I'm going to say transform dot position equals the wanted position, okay? Let's see what this does when we hit play. Let's let it compile first. And I'm going to hit play. And you'll notice that the camera now is back 10 units. So as we decrease this, we can move the camera back and forth. Now the camera isn't actually looking at the the bar bearing yet. And that's just because we need to actually put in a really, really simple built-in method that Unity provides us called the transform dot look at method. And all I want to do is just give it a vector three because you'll notice up here in the IntelliSense that it's telling us that we want a transform. So we can just do m target for the transform, okay? And now if we hit play after it finishes compiling here, there we go. And now we're looking at the player or the bar bearing. Awesome. Okay, so now we want to utilize this height variable. So what we can do is we can just add another vector onto this vector, right? Because we can add vectors together. So we're going to add this vector with another vector three dot up because we want to go up in y, okay? So plus m height, perfect. All right, so let's take a look at that. Okay, hit play. Oh, and we got an error. How dare I? Let's take a look and see. Aha. So you can't add a float. You have to multiply a float onto a vector. It's just the rules. Okay, let's hit play. And there we go. So now we actually have height, right? So what we did is we first got the forward position, negated it, multiplied it by 10, then added on the vector three dot up variable and then multiplied that by the height variable here and we got our height. And so that's basically your run of the mill follow camera. So if I were to move the barbarian now over here, you can see that we're following the character or even rotating around with it. Pretty cool. So the last thing that I want to do is set up this smooth speed value because we want to kind of smooth this out. We don't want it to just be stuck to the character like that. That's not from a aesthetic standpoint. That's not very cool. So let's do a vector three dot lerp. Okay, we're going to go from the current position that we're at. So this transform that the script is sitting on is the camera. And we're going to go to that wanted position. And then we want to put in time dot delta time times that m smooth speed. Now that's going to control how fast or slow this position catches up with this position. Okay, and we're multiplying it by a time dot delta time because certain CPUs will run faster than others. And so this basically scales this value based off of how fast unity is running based off of the hardware that unity is running on. Okay, so that just ensures that you get a consistent feeling between all different hardware and platforms. All right, so with that we have our basic follow camera all set up. So let's take a look at this now. All right. Very cool. So let me hit play. And there we go. So now you can see that we're getting some smoothing. So I'm going to just move this to five and maybe something like four. I don't change the smooth speed up to four. So it goes a little faster or catches up faster. And there we go. Now we're following the character perfectly. And we're getting a nice little smoothing going on there. Now you'll notice that we're actually getting a couple of issues here. If I turn really fast, you'll notice that the camera isn't following in a straight line anymore. I mean isn't following in a arc around the character. It's trying to catch up to that. It's better viewed from the top here. So if I go in an orthographic view. All right, so let's actually just move it around. It's not trying to maintain its distance as it's rotating around the character here. It's just trying to catch up to that point. All right, let me actually do this a little bit better here. So you notice how we're getting that kind of weird. It's kind of all over the place. And we really want a little bit more consistency. So in the next video, we're going to take a look at a couple other ways we can smooth this out. And then finally, in the last video, we're going to do the proper smooth follow camera using angles instead of the vectors completely. All right, thanks so much.