 Welcome to another IndiePixel tutorial. My name is Kenny Lammers and I will be your instructor throughout this course. In this course we are going to create a really, really basic follow camera system, all right? But what we're gonna do is we're actually gonna take a look at some of the issues that you can run into when creating a very basic follow camera. And I'm gonna show you how to resolve those issues, all right? So moving forward, what are we gonna do in these next few videos? Well, we are gonna talk about building upon the camera framework that we have been working on so far. If you've been following along with all the other videos in the camera framework series, we are going to build upon the core camera functionality that we have already put in place. So we're just gonna keep adding different camera types as we go along. So we don't have to start over and over again. And it's really good to start doing that with your own projects and your own frameworks. So that way you give yourself a head start when you start new unity projects. We're gonna learn the basics of building a follow camera. So some of the math that goes behind it, the vector math that goes behind it. We're gonna identify some of the issues that are going to arise when we set up the basic follow camera. We are then going to build a more advanced follow camera that takes care of those issues. And I'm gonna show you how to debug those first so you can see what the problems are. And then we're gonna learn how to fix them. All right, so it's a good workflow to get into. Okay. And then finally we're gonna take those two cameras that we built in this series and add them to our camera menu so that way we always can create those without having to go and create a new camera by right-clicking and then dragging and dropping the camera scripts onto those particular game objects. All right, so it just makes it a lot easier. Okay, so let's get going and start with the basic follow camera script. All right, so here we are inside of Unity over here. And what we wanna do is set up our first basic follow camera. So I want this camera to follow around this barbarian dude right here, okay? And now I have actually purchased the Barbarian's pack. So if I were to jump over into my browser here, I purchased the Fantasy Horde Barbarian's pack by Polygon Maker. And that is the character that we see inside of Unity over here. All right, so I just wanted to give a little plug there. Those are really cool assets and very high quality and complete. So just wanted to give a shout out there. So in this video, we are gonna create a very basic follow camera. And it's very, very typical for these types of cameras to be made for your games because you're always gonna wanna follow some sort of character at some point. And I really just wanna run through the basic one first and then show you how we can create a little bit more of an advanced one to take care of certain issues that arise by doing this really basic one. So let's get started. So I'm gonna jump over here into the IndiePixel cameras folder over here. Now if you don't have this or you haven't been following along with the series on cameras over here, I would just go ahead and pause the video and recreate this folder structure right here, okay? So what I'm gonna do is jump into scripts and create a new C-Sharp script. And I'm gonna call this IP basic follow camera, okay? Okay, and now that's just my naming convention, all right? So then I wanna give it this little custom icon just so I know that it's a part of my framework that I'm building, okay? It just helps me to identify it when I start to import other scripts from other packs and stuff like that. All right, so let's pop up in the script inside of mono develop and get started, okay? So first things first, I always like to put it into a namespace. So I'm gonna put it into the ndpixel.cameras namespace, all right, and that just protects it from clashing with other scripts that might come in from other asset packs, all right? And you'll notice that we also have, I don't need these guys open anywhere, we also have a base follow camera. So let's actually open that up over here. All right, now I need to rename this to basic follow camera, that's weird that that got named like that. So let's do this, let's actually just rename it so the script actually works. Alrighty, we might have to pop it back open inside of mono develop here, give me one second, that's weird, at least this one's right, we'll see what happens. Anyways, getting back to it, we have this base camera and I wanna be able to inherit the functionality even though there isn't a lot of functionality in this script. What I wanna do is I want to be able to utilize these variables and these methods in this script. And so to do that inside of C sharp, what we're gonna do is just extend the base camera. So we're gonna inherit basically. So now we inherit all that functionality. For instance, if I were to start typing out handle camera, or let's say, let's actually pull back in the start method here and I could just call handle camera like so, right? That basically is going to run whatever type of function is already in this base camera. So now we don't have to type all this stuff over and over and over again. Okay, so let's get our region in place. So do a little setup here. Okay, main methods. And this is just a pattern that I like to follow myself. All right, so we are all good to go. And I do want to override. Okay, so let's get this last thing in here set up. I want to do another region. And this is gonna be my helper methods and region. And I wanna do a override of the handle camera. So I wanna override the functionality that's in here or utilize what's already in here. So let's do that. So I'm going to do a protected override. And you'll notice that the handle camera function pops up for us. So if I hit enter, it'll automatically fill in this functionality. And what we do need this base handle camera because what's gonna happen when the start and update functions fire, okay? It's gonna roll into this script. And then it's going to say base. So the base is the base camera right here and it's gonna run all this functionality first. And then come back to this method right here and then run whatever code we have down here, okay? So let's get a couple of our variables set up before we get into the meat of the camera code. So what I wanna do is type out a public float distance. So we want a distance value, okay? And I'm just gonna initialize that to something like 10. And then we're gonna do a public float height variable. And we'll just initialize that to five. And then finally I want a float called mSmoothSpeed. Now this is gonna smooth the camera out. And I'm just gonna initialize it to two right now. And let's actually name this correctly, okay? Perfect, now with that, we are all ready to go. Now you notice I didn't need those main methods anymore, right, because I'm inheriting from the base camera. So these functions are gonna run anyways because we've inherited all that functionality. So now all we need to do, and this is why this is really cool, is just override the function that we want to add on to. So we're gonna add on functionality to this base camera and call it the follow camera, okay? So in the next video, we're gonna actually go and start to hook up our basic follow camera code. All right, thanks so much.