Advanced Roblox Scripting Tutorial #28 - Camera Manipulation (Beginner to Pro 2020)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay welcome back to a brand new roblox trippin tutorial and in today's video I'm gonna be teaching you guys about camera movement okay now let me go ahead and show you what I'm gonna be teaching you first and then we'll get into it okay so let me go ahead hit play here also guys I apologize to like a bubble recently I've been kind of busy I just gonna kind of moved but anyways look at this so as you can see my camera moves it goes to here and then it comes back alright now I know that's pretty simple but I I could go in a lot more depth than I actually will during tutorial but I just wanna show you guys the basic stuff and then the other stuff you guys can mess around with yourself I'll teach you like kinda messing around with and stuff like that but um yeah it's pretty cool right I haven't focused on this part and then I have a comeback and here it is okay anyways let's going into this video alright so before I start real quick I just want to say I apologize I don't upload in a while guys I like I said I just moved and I got kind of busy so I'm back don't worry okay new videos every other day starting now but um I'm also gonna make a how to make a gun series right but I realized actually need to explain the camera a bit more so we're actually never seen it before so that's why I'm making this video right now so yeah alright so if you guys are new to my channel make sure to subscribe for more awesome videos like this well then that let's get started okay so first things first let me go and delete everything else I have start from a blank baseplate alright so what I'm gonna do is go ahead and enter a local script into our starter Player scripts what do you local scrip to mess with the camera right makes sense okay and then I'm going to go ahead and make a parts that we want our camera to focus on all right now um as you guys saw I had it focused in that little part I was like this long right now this could be cool because like you know our simulators have like shops and stuff where they have like I don't know like they have like a weapon right like for example they have mmm okay no that's right here pistol you see they have this pistol right here okay and then when you go on the shop alright there's obviously no part in front of it but like you zoom in on a knee and it looks like this right you can see it looks all nice that's how they do that they use a part right then ormally put a part around the thing like that and then they just make it fixed onto that object and what it does is it looks like you can see the you know crap I can see the pistol nice and good normally they have like a little shop we can press arrows they click left and right and if you just want to do that you literally could it's actually pretty simple but you need to obviously own a camera's work so yeah anyway they're not going to do that right now though we're going to use a basic part let me go ahead and make that visible again my sitting the transparency back to zero okay perfect alright so uh let's go ahead and first off show you how we actually move onto a part okay so first things first we're gonna explain a few things okay so how do you actually get your camera to mess with will you set it equal to a variable called camera or cam whatever you want to call it I just call it cam but um how you do it is you do workspace dot current camera and this is actually gonna give you your camera that's that's how you do it but yeah and this is how you mess with it you got to change all the properties of the cam right so what we're gonna go ahead and do now is I'm gonna explain a few properties to you first about the camera that you need to know okay so the most important properties that you need to know our camera dot focus okay so focus camera type okay that's another one camera type because you can change the type of your camera and then cam dots camera subject and then also one more maybe C frame and then field of view these are all pretty important these like the main properties that you're gonna mess with all right so I'll explain each one of them in this video so yeah don't worry cuz you're gonna learn all of them today if also if you guys don't have any experience with see frames definitely go watch my C frame video or else you may be a little confused on this one anyways alright let's go to start so first things first I'm gonna show you what camera dot focus is okay so how we use camera dot focus is or what it is actually should I say is it's it's the property that represents the point the camera is looking at so basically if you set the focus to this right here the camera will look at this right and that will update the camera viewed or go closer and your look at it so we're gonna go ahead and do is just set the camera focus to that so let me go ahead mix edit variable two and let me rename this part to like focus part there we go and then we're gonna do local focus part is equal to game about workspace top folk his parts alright and then we're gonna go ahead and do focus or no camera dot Kim or the camera not focused sorry cam not focus it's equal to focus part and now what that's gonna do is it's gonna focus on the camera now before I actually run the script I'm gonna go ahead and put like a weight up here I'm gonna put like weight 5 because what will happen is actually the camera will find or like the script will run and find the camera but there won't be like a player that it's manipulating so just put a weight on it now how you can only fix this is just make a script where you like you started the script whenever the player joined right so you can have like a a service script on here that was like you know player dot on player added but I'm not gonna be able that right now should I put a weight to make it simple okay um so yeah just put like a weight 5 up there that should be good enough time and then I'll actually go ahead and put it like prints script has started running there you go okay now let's go and run the script and it should work just fine alrighty let's see let's see oh come on and like my studio is crashing classic oh wait there we go we got basically ok it's loading and now you can see we're on here ok and we got an error all right my bad yeah I'm really stupid I'd can't focus and actually the property that are like the value tip that camera focuses is a C frame so you just need to put dot C frame at the end here and it'll work but yeah so let me go ahead and do that again and it's gonna focus on that point and it's getting the C frame out of there from that part which is easy to get you know so now it's stripper started running and it did not work my favorite now the reason why I didn't work is because I didn't change my camera's type nice nice nice okay so uh alright guys I'm doing horrible this video but anyways you need to choose your camera type okay your two scriptable okay because if you don't do that it's not gonna work so yeah so we're gonna do is actually change the cam camera type and change its descriptive bowl now what is scriptable okay this is how you do it right now what does the camera type cuz I haven't for that yet so let me go and actually explain the camera type real quick you guys and I'll come with this out so I can show you real quick okay so I'm gonna start the server or start my game and show you all the other types of camera types okay so we're gonna do is go ahead and audio workspace here camera and then you can see our camera is humanoid but now I can change it alright so we have here our camera type okay and by default it's on a custom okay and custom it's just the debt regular camera type okay you just walk around and you know you can go this way that way and I realize I'm plugging my friends you see you item sorry about that uh anyways um so yeah you just kind of go like to us you kind of go around like a normal camera okay and then you have attached attached is where you can only move up and down in the y-axis I mean it's what it looks like at least right and you kind of just follows you like that so it's not the best camera it's not very pretty to use or cure Matla best camera type but you can use if you want fixed is where it actually is stays still okay the camera doesn't move at all the player cannot control the camera at all so as you can see I'm running over here but the camera staying right where I put it originally right and then you have follow this one I don't know the difference between this one in custom it I think it's slight I forgot the difference but I actually do have a little you know Kim type cheat see right here okay you can use real if you want camera moves with a subject and rotates to keep subject in the center so yeah that's what that does so if I go ahead and go like this it should go back I think I don't know honestly but you can read about that if you want but that's what that does and then scriptable is no default behavior you need to actually script this one custom is default and then and then orbital and this one so yeah I'm not gonna go through all of them because obviously left threw that on yourself also just kind of confusing but this is what all of these do and now this is orbital man this one's weird it's like it's like the you only stay like right here it's weird anyways that's what those do okay those are camera types different types of cameras and that's you actually just actually script our camera we need to change the camera type scriptable obviously okay so we'll do that right now or it actually only good I just think it can't be custom but anyways let's do that see if this works and it still didn't work my favorite okay so what is going on right here I do not no let me go ahead and look to see mmm-hmm it should be working this I don't understand the camera focus should be a C frame right and I don't I don't understand here is it C frame him well she's just a fixed okay make it fixed was so where it doesn't move at all that's that that should work now I think I don't know it's Cantonese confusing it just worked for me last time I I don't understand oh there we go now it worked I don't understand why scriptable didn't work Oh probably because I didn't oh wait a minute wait a minute let me see something real quick okay I'm gonna change this back to descriptive will here and yeah I know why didn't work okay I'm pretty sure all right so watch look what happens fixed worked right but scriptable didn't all right so look at this I'm gonna turn like this way and okay all right so see scriptable I I didn't actually okay yeah okay so huh all right well good thing I sign this for you guys scriptable basically right you have to change the way it's looking and the C frame focus does not work on scriptable okay focus is gonna be disregarded any other property is disregarded pretty much all trip table besides field of view I think because you actually customly you know did you do custom li scripted okay so fixed right what happens with a fixed camera type is it just stays there you can't move it you can't rotate it's just fixed on the on the part right which makes sense so let's go to that again and see you guys see it's fixed on here okay yeah all right well that makes sense sorry if I confused you a little bit but you see that you always have problems during scripting it's like that sometimes but yeah as you can see now scriptable you have to even change the see frame of it and not just to focus and focus isn't gonna work but yeah okay anyways so now that we have this and that worked what we're gonna do is actually go ahead and make this go back onto our our player okay so we're gonna go ahead and go like this we're gonna do wait maybe three seconds okay so we can look at it for a little bit and then we're gonna go ahead and do cam camera type I wanting to wash it well first of all change the focus so camped out focus is equal to focus or now is able to player we don't meet our players all right so let go up here real quick inside your player sorry about that local players you go to game not players that local player player and then I'm gonna do player dot character dot humanoid now listen you would think right you can't really set your like you know your focus equal to humanoid but little do you know you can all right and actually we probably just on the camera subject to this so let me go and do that alright so the camera subject where's camera subject it's like focus but basically it's just a part you should put you put it onto a part okay focus is the see frame so yeah so that will change the subject back to the humanoid you would think you make it to like a human at a root part because it's sexual thing but no the humanoid for the cameras what you use I mean you could use humanity part but it wouldn't be normally how it would because by default it's on humanoid but I was continue a 30 seconds and it did not go back awesome awesome awesome awesome awesome awesome awesome don't know why maybe focus is gonna work now oh wait I'm dumb I'm down my bad guys I forgot to change the camera type back to custom there we go hit play and this should work just rice here we go okay so we're gonna wait three seconds and then it should go back on there there we go like we get one of the two you know wait three seconds and go back onto our character and yes it worked just perfectly how we wanted it to work it did okay now maybe you may be wondering now okay well how do you get your camera to move right because like all we did which is teleport it back to our our player and then to this part so how do we get it to move so how you do that is I'm gonna go delete all this so you want to save this save it but yeah okay that what you can do for that is actually use your C frame okay are you would interpolate it so let me show you how that looks okay we're gonna delete all this stuff there we go and they'll change the camera dot cam or camera camera type back to scriptable okay alright so now we actually to script it so we have to put down scriptable okay what we're gonna do is go ahead and script it so how you normally do this is you use a function called interpolate now actually this is not recommended by real Electrolux even says on the wiki page it says the recommending tween service you can use tweens but I might not understand what tweens are so I don't wanna make us any more confusing I'll use a built in function for cameras called interpolate and basically what this is gonna do is as you can see here the properties it gives you our C frame and position and C frame and focus so where do you want it to end and where do you want it to be focused on - right and then oh crap and then the duration in time in seconds okay so we're gonna go ahead and do is actually set some property to go to this so we're gonna do our focus part dot C frame okay if you don't know what C frame felt like I said guys go back my CPM tutorial it's probably important but yeah so we'll do that and then we'll go ahead and do you want it to also we want that in the focus Bartowski frame and then you also also wanted to focus on the focus part so yeah we'll put the same thing for that and then how long you want it to last maybe two seconds should be good and then we should go out and hit play and it should work just fine all right I'm excited to see this it looks cool I also run away real quick and then we'll see it happen okay I'm going I'm going and oh look okay boom boom and boom and now it actually went inside of there and I think I just died but I think I'm waiting suffocated I don't I don't know why I'm dying but besides the point it didn't work okay and foot is int or foot the camera into our oh I walked off the map that's why anyways it did work it put us into our part and but now like I said if you wanted to actually have it like that like a good animation you'd rather have it focus of something else right you'd have it you ought to have it focusing on someone else or you would have it transparent right so you don't actually have a focus on the same thing normally make another part here and then it could it could be right here then blister me here but in the focus would be on this part right so that makes sense but for this for this example I guess we can just put the transparency to zero and or to one my bad and now it's gonna be completely transparent so now when we go to it and we hit play it's going to go there and we'll put a move it so let's see where it is that's where it is and it's some reason some extra camera black I'm a local free zone one that when it happens oh because we're probably cuz we're focusing on the same exact part which makes sense so yeah so if you want to focus on something else is that that's what you should do anyways that is that and actually I want to test this I want to see if I don't deserve it is why let me make another part actually so I'll just put another part here and it's actually it's not the focused part name this end part and then we'll name this focus part okay and then we'll do a local and part is equal to game now Lorch based on end part and then we're gonna end it on the end part dot c frame okay and that should work oh wait no no no no Dom okay it doesn't even matter I just named it differently but really that the end is the first value and then the focused part is the second parameter - sorry about that anyways there you go now it should end on the end part and then focus onto the focus part so let's see if this works and I probably should make this transparency - oh crap oh wait nevermind I'm dumb I'm kind of messed up but as you can see we're now ending on this focus power here or on the end part we have renamed it um I'm making this confusing I'm sorry we ended on the end part and now we're focused on to this focus part so it works just fine as you can see a little character in the back here looking nice yeah okay well anyways use code tap you already know guys I am a star creator head another channel called tap water bye anyways use code tab when bhangra which is premium okay is best code ever and if you like the story I'll definitely use it anyways that's pretty much that that's how you move the camera around now if you want it to actually like make it follow apart um stand you can just set it to fixed and then you could just move the part in a different script right and then it'll fall apart it will keep following it a lot of things you can do with camera I did not go over everything in this tutorial I would be way too long why did but I actually will show you I will show you the field of view that is so if I go ahead and do cam that field of view I can set it equal to a number I think it's between one I don't know let me look real quick I think it's between like 180 and are not one and 120 and the default is 70 so let us go ahead and change this to 30 and you'll see what happens okay so I'm gonna go ahead and hit play and it's gonna assume it's normal five seconds where I put a weight there and then and that's gonna change the field of view so like watch this you'll see it you'll see what I mean so here we go and boom you see the field of view it it just changes so basically it's like zoomed in kind of I guess I don't know how to explain it but that's this you can just tell the field of view is obviously different than what it was and then you can make it larger right the default default is 70 but we'll make it bigger which is it goes from it goes from 1 to 120 so we'll make it a bigger number with it like 120 something like that and then we'll start the script and then watch what happens now here we go and oh look at that it looks so weird I get obviously one I'll put like this but like you know what I mean like when sometimes people make the wrong script or whatever like when you shift a sprint they'll have the field of view change right so it looks like they're running like zoomed out so sometimes people would make that and their scripts which looks kind of cool I guess I personally I don't like it that much when they change the field of view but I mean hey if you think it'll look good for your game do it but yeah anyways that's pretty much all of camera not all of camera sorry that's all the important properties of camera we went over see frame well actually I didn't I guess I didn't go over see frame but if you wanted to like change it just instantly you would just you know chance at the camera or camera subject to scriptable or no sorry enough enough subject camera doc can't or type to scriptable and then you saw the see frame equal to whatever you wanted right so we could do see frame you will do 10 10 10 and now it's going to move our camera dot C frame into 10 10 10 yeah oh wait no no no I explained that wrong I'm sorry I'm sorry okay that's how you change the position but where you want it to look at if you want to script that it's actually in the same thing so you would do like C frame new I want to look at zero zero zero and now I know this looks probably really weird but you'll see in a second here and let me actually let me make a let me do this somebody the local camera C frame camera C frame is equal to this I'm sorry this might be a little confusing but basically how C frame works oh wait let me okay all right what one second guys don't worry I'm ray I'm gonna figure this out for you okay don't don't worry yeah okay okay uh here we go just wait one second I promise it'll be worth it okay I see freedom dot all right so we first need to do the local position okay so where do you want it to end so we'll do local pause and then we want it to end there right or we can even do we can even do a vector as we value like you know like for position so we'll get back to three got new we want it to be at ten ten ten okay that's where we want it's the position of the camera to be and then weird wanted to look at you see then then you do another vector3 value or see um maybe if C frame but I think vectors ladies the way you do it and then you just pick we want to look at so we'll actually have a look straight down what is zero zero zero and now it's gonna happen is well we're gonna put in here the camera C frame so we're gonna do cameras keyframe dot or local camera C frame is equal C frame not new and they're gonna put the position and then we're to look at which is there and now if I put the C frame in there said that you go to there it should be at the camera should be at 10 10 10 so for the position and then it'll look at 0 0 0 I think is what I typed right yeah so as you can see it's looking at 0 0 0 from 10 10 10 and I don't know why that's there I think that's so I'm going to do with yeah I know I'm sound of the base plate just looks weird but yeah as you can see that that's how we're and yeah I mean that's how you do it and now it actually wasn't out looking straight down I said it would but if you if you wanted look straight down you just put it straight up and then it can look straight down but I had to look down a little hard to look at an angle because it wasn't actually right above it but um yeah that's how cameras work I know it was a little bit long but like I said I like to go in depth - Orioles so that's how you do it right pretty freaking cool awesome awesome awesome hope you enjoyed this video guys if you did like always make sure to smash the like button okay and subscribe for more awesome robust ribbon tutorials just like this one and also have actually have a really cool you see that I'm coming out for you guys so I'm really trying to show you guys that it's gonna it's gonna be so cool I think a lot of guys gonna like it it's like a hair so that's one Wednesday but yeah anyways hopefully go figure it's that soon but yeah also I'm gonna keep making aching a be making a done series like how to make a gun how to script to go ahead and make the camera all that good stuff so if you want that make sure to scribe for that too I just wanted to explain the camera first because I need explainin it or anything I need to use that in the gun series so yeah alright that's it hope guys enjoy and I'll see in the next one peace
Info
Channel: TheDevKing
Views: 118,963
Rating: undefined out of 5
Keywords: TheDevKing, Roblox Scripting Tutorial, roblox, studio, coding, tutorial, camera manipulation roblox, roblox studio, how to script on roblox, roblox studio 2020, how to program camera roblox, roblox camera manipulation, roblox camera manipulation tutorial, how to move the camera in roblox, how to move the camera in roblox studio, how to make the camera move in roblox studio, how to make a camera in roblox studio, how to make a custom camera in roblox studio
Id: tYX8AorcPew
Channel Id: undefined
Length: 23min 11sec (1391 seconds)
Published: Thu Feb 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.