Revealing the Secret to Flying the Millennium Falcon in Unreal Engine 5!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody and welcome to another tutorial on arganian's puzzle box in this video we will be looking at how to make a flying well how to get a ship to fly in space at low speeds high speeds rotates you know flip around and all sorts of things and we're using the millennium falcon the black edition in order to show the proof of this concept [Music] now i i want you to understand that what i'm doing here is not necessarily the right approach to making a video game in which you can fly in space this is just my interpretation i've used multiple sources of inspiration from different kind of people who have content on youtube in which they each of them had a go at how to create a flying system and i have basically put it together to work in my favor for my scenes i think it's a wonderful way to present a project to just fly around in a spaceship in whatever sort of environment i've created and also you can you know you can fly jets this way you can fly planes in this way i think it's really um really entertaining and and really eye-opening when you really start to traverse your scene at very high speeds um you know or low speed or whatever and you have also have gravity that pushes you down or you can you can sort of float it's really nice and then and really it's like a seamless sort of process once you get the hang of it i i really enjoy spinning around the um you know meteors and sorry asteroids in space and whatnot is really cool but uh i mean very important to note here is that this project file the the project that um i'm i'm putting you know i'm showing you the tutorial in is available on my r station or the gun road page so you can get that if you want and you can just briefly play in there with these with this ship because it's already set up in there for you guys um and also the the scene behind me as well as you can see that's this is my new sort of setup my um my deck in which i'm filming i'm still trying to work it to look better and also run better and also be more integrated with me within the environment so i'm still working on that um but i am probably going to make this yeah i'm going to make this project file available on on my patreon just so you guys can have a play around with it so if you really like what you're saying behind me then you know very soon that will be available on my patreon so please subscribe to patreon if you want to but do consider buying some of my projects from our station organ road at the price of a coffee so if you want to buy me a coffee uh then please do so it really supports me and the channel uh which is really starting to take off so um yeah um let's uh let's just let's begin the tutorial and i hope you guys enjoy we are now in the scene in which we will be conducting the tutorial um and this is you you will recognize this scene from one of the project files that i've made the well i've made the neutron star inside of this project so in my previous tutorial where you saw that being made it was in this project and this project is available on the marketplace if you want to get it um if i play you know if i press play right now you can now see that the ship i've got the ship over into into the scene and we're gonna go through what makes this sort of animation possible as you can see i don't really have any boosters at the back of the ship i've not yet done that that's for the future sort of development of this of the tutorial series but you can see i'm flying the uh falcon through the scene uh this is the millennium falcon for definite it's just texture this way because this was the only texture that would look good enough on this particular mesh which i've taken off of sketch fab as i didn't want to um you know go and model uh i millennium falcon myself i just took this free asset from the sketch sketchfab place where i'm going to link in the description below so you can actually get it yourself but as you can see i've got in the left side of the of the image i've got a torque slider so i'm going to show you how you can set that up as well it's not complicated at all so it's very simple to do but that that progress bar fills up as i increase the speed and if i just press w on the keyboard the speed at which i will be maximizing my you know my speed will be my velocity i put it as torque but you know obviously you can put it whatever you want the text isn't is meaningless uh that is uh capped at 10 a power of 10 but then if i press shift this goes up to 200 which basically means a lot of speed okay and this is very useful if you want to do like um i don't know something like intergalactic space travel or anything like that because that speed can be anything that you want it to be um so yeah but we're going at really fast speeds anyway i mean this scene is quite big i'm not really sure in terms of um size of the unreal engine size how big it is but just you know it's really big it's a really big scene so i'm traveling incredibly fast okay um okay but as i said there's no there's no limit there's no cap to this you can you can have your um you can have the speed uh as as you know as fast as you possibly as you can i i guess if you go to um very very very high speeds you may see a big decrease in performance actually so uh when you're speeding up because the unreal engine will try to load all these assets through and you know it really depends on how expensive and how filled the world how full the space area is now uh what i want you what i want to show you is what sort of comprises this particular setup that i've done so we've got um in the input tab please have a look over here although i'll be going through this again but it's you know we'll have to set this up uh the way you see it in here but more importantly in the maps and modes i have created a new spaceship game mode so opening the content browser this is literally a game mode that i've made so you can do that i'll show you because we're going to go through this and we're going to make it but this is quite simple you make a game mode you select certain parameters in here such as you know the hud that you want what's the pawn class uh if you have any spectator pawn or anything like that so our millennium falcon ship is actually a pawn not an actor and that there's a difference there definitely because it also if you make it as an actor you need to use um a slightly different blueprint nodes in order to get it running if you're using a pawn you have to use the pawn variant blueprints for that and i've used the pawn because it's a static mesh that we're actually putting in here we're not putting a uh we're not putting a a skeletal mesh although you can do it with a skeletal mesh as well uh it's not really a problem the the workflow doesn't change much between the two but with a skeletal mesh you want to also load some animations but this is purely for the static mesh so it's a lot simpler to put together and every anybody can do it quite quickly so we've got the game mode done uh there's another thing that i've got in here which i am um just trying to find so if you look in here i've got the ship hud so if we open that this is there's a widget so the widget itself is this torque and progress bar that you're seeing in here i'm going to show you how to set this up it's quite easy and then there's a ship hud which is um it's well it basically brings it it's sort of oh sorry it takes that widget and it constructs the widget that we've made for the progress bar and then there's a there's some well there's a there's no nothing in the viewport that you can see but in the event graph this is where i'm loading that uh when we press play um in the engine and then there's also the actual millennium falcon pawn class so if we have a look at this um there is so you know just just make it i'll make it a bit bigger just so we can see uh what we've got in here we've got the spaceship that's being loaded and that is well that that's the that's the route for the spaceship but uh we you can see we've got the millennium falcon in there you know if i double click this will obviously open the ship which by the way is it doesn't look amazing from up close oh it seems that i'm inside of it so you can see i've got quite a few errors on the textures and so on because i didn't unwrap this i sort of did like a like a very rush job of just unwrapping it automatically and blended and whatnot so it didn't do a very good job but i think it's good enough for our intended purposes in this video um so we've got uh so we've got we've got the mesh we've got a spring arm with which a camera is being attached to so the camera follows behind of the ship and it's on a spring arm so we can have a bit of wobble and movement and lag uh what we're doing in the blueprint itself in the event graph because there's nothing in the construction graph it's just the event graph we've got an area where we're setting up our tr first when we start playing then we've got an area where the thrust is being calculated either at very fast speeds which is this one or at normal speeds um then we have uh velocity and rotation this is where all that is being sort of put together and then we've got the control so move up move left or right and roll so all of these together make up the system in which you're able to fly the ship so we're going to start now from the beginning putting everything together uh we're first going to create the game mode then i'm going to move on to creating the blueprint for the ship and then lastly a you know quickly a widget uh for a with a hud in which you can see your sort of speed of the ship if you like uh but i think that that's very important that i do that because then you you're fully understanding you know including what sort of measurement units you're using to be able to to work out how fast you're moving is it's quite an interesting sort of concept to do it that way as well uh but don't don't forget you can buy the these projects from my our station page or gumroad so you can get all of them from there and you know they're quite i would say i mean they're very cheap what five things about four dollars or something a project so i think you know it's just like buying me a coffee if you want to buy me a coffee that definitely helps a lot and supports me making more of this content so yeah let's uh let's begin the tutorial what i would first recommend that you do when uh before you you know you create a project is you switch it over to a blank now you may want to put it as a third person or first person or whatever you may think that's fine but i normally start with a blank project so i'm just going to build this within this project it's not really a problem but as i said i personally go for a blank project another thing that you want to do if you're building planets and space scenes it seems that an unreal engine 5 this is preview 2 by the way but it works in unreal engine 4.27 as well over 4.26 it's not really a problem but i've seen that in unreal engine 5 the large-scale sort of scenes like this one have a problem so what i mean by this is if we go in the world settings and if you can't see this over here just go into your window and make sure you've got world settings ticked so if you go to world settings there is an option in here where it says enable large worlds if you don't have that ticked this is what happens the world becomes blank if you look in certain directions i thought it was a glitch but it's actually just this option in here so enable large worlds and then you're good to go um okay so that's that's just a bonus tip right there for you guys um and now what we want to do is we want to go in our project settings which i am trying to um trying to pull out somehow okay i've got it over here and in the project settings in the input option which is under the engine section um so just make sure you click input like that so you're seeing you're seeing all the options you're probably going to have in here either you're going to have some action mappings or some access mappings depending on if you made a blank project or not if you didn't or whatever doesn't matter what you have in there you can delete all of that and just put them in this sort of scenario in this sort of way now i've called this supersonic you could call that whatever you want but that's our that's my trigger to tell unreal engine that i want to go fast or whatever you want to do these are trigger maps that you know actions that you can press and this is the axis this links to your mouse and to your keyboard so your mouse will be your view will be locked to your mouse you don't want to see a cursor around the scene you you basically can turn around the ship um on its axis using the mouse and so you can see you can look up and down with the mouse and then you can roll left or right with the mouse but you can also roll with a q and e and i've done that because it's actually easier to use these two uh keys to to to roll and then w well w is for us forward uh s is backwards or not backwards it's more like stop you can go backwards you've got to turn around and then you've got move right and left and then just make sure you put these numbers in here a negative order with a positive otherwise it won't know whether it's a left or a right or whether it's up or down you know so that's that's important to to do that okay so uh once you set this up then you go into your map modes and whatever you may have in here we need to create our game mode a new game mode for this uh because you're going to see a bunch of different things in here but we want to make a new one so what i'm gonna do let me just take my project settings away and i am going to open a new uh where is it now content browser um okay and let me just make a new folder here i'll call it um tutorial so sorry i've got this microphone in front of me so it's a bit difficult to see anyway right click and then we can create a blueprint class and over in here we want to select game mode base and then we can call this i don't know bp game ship doesn't matter whatever you want to name it but obviously you should know what you've named to um because then when we go into our project settings which again i'm struggling to open um if i then you know press this button you will see that this game ship now shows up in here if we click it this is now opened well this is now open the default upon and so on because that's how the blueprint is generated so we need to change that to whatever our new settings are which is just fine because we're going to create all of those okay now the next one we want to create our ship blueprint which in my case is upset to you is a pawn so that's important to to remember so now right click and select blueprint class again this time we'll go we're going to press our pawn and then put bp underscore ship okay very simple naming convention um i like to keep things simple so we'll open our pawn over here and this is our this is our window there's nothing inside of it if you want to rename this just click it down here and then press f2 or right click for rename and i'm going to call that ship roots and you can see it's now renamed it up here now if you have a selected every time you press the add button it will add something and then pair it or parent or yeah become a child to the root and to whatever subsequently comes down so in this particular case we're going to add a new uh static mesh and we're going to call that ship uh we need to load the static mesh so i'm just going to type in falcon that's my mesh over there and you can see it's now been loaded and i've got an important thing to say here as well let me just come out of the so when you import a new mesh in unreal engine maybe its rotation is not uh facing the right way so in this particular case the millennium falcon is luckily facing the right way which is its front has to be um facing or has to go in direction of where the y axis sorry the x axis is pointing out i'm pretty sure that's the area yeah so where the x axis is pointing out you see x being zero so you want your ship to go forward like that so we need the x axis for this um so if you if it's not um what i would recommend is you go into a software like blender open the ship rotate it so that it faces the angle that you want and then bring it back in re-import it and that should be fine and also scale it in there if you want to so you know to have the proper scale now once we have the ship then we can have it selected then press the add button and type in spring which will bring us a spring arm which i'll leave it with that name that's fine and the spring arm is pretty much centered to the ship by the way but you've got some options in here like target arm length so if you put that maybe to 1500 um maybe that's not going to be enough let me just try sorry that's the camera at 1 500. so uh i forgot to do what i was supposed to do the spring arm is in the center it's as i said it sends it to your ship to your mesh but what you need to do is you need to add a camera uh and i'm going to add just the camera and now the camera is parented well yes parented to the spring arm um and then when i saw the spring arm i can now move the camera backwards so let me just do that you can see it's now over here by the spring or maybe i'm gonna put it to 2000 um and now the camera for some reason it's not moving let me just see uh probe size camera 12 yeah it is um [Music] it is already connected um interesting let me just try okay there we go 5000 seems it was just not i wasn't using the right uh sort of settings so the spring arm is now at 5000 and maybe i'll lift it up on the z-axis like that so it has a thousand okay now you can you can test this out if you want by draw dragging in the blueprint within the scene and you can see with the blueprint selected you can see it's showing us the camera and what it views right now so that's i think that's that's pretty acceptable um in this particular state let me just delete the the blueprint that i've added and then go back in here but we'll just leave it as that that the camera is now set up properly we don't really need to do anything else with that what we still need to start doing now is adding some parameters so we've got these uh variables in here we've got components so we can leave it as components then we want to add variables for thrust for rotation for velocity all of that in all that jazz that will make our ship fly and then we can use those into the event graph to um basically um you know code them in just don't forget to press compile and also save your project every time you reach a milestone otherwise you might lose your work which i tend to do a lot in unreal engine 5. okay now the first variable that we want to add we're going to press this plus button in here and we're going to type in thrust and you'll see by default it's now set to boolean and also this i over here is not pressed so you want to press the i mix that makes it visible if you have the blueprint in your world somewhere that you want to select it and then just change variables to it you don't need to do it for this particular blueprint but just just me telling you what the eye will die we'll we'll do we'll just expose the this particular value into the editor when you have the blueprint in your viewport now we will need to change this from boolean to uh to a float and then when we press plus again you'll see that it generates a new um a new variable and this time is already selected with float because unreal engine sort of assumes you want to make a float again because why not obviously and we're going to name this max first and then i'm going to press this again i'm going to call this gravity threshold so that's going to uh be you know it's going to decide how how what our gravity is like so in this particular case will be uh minus 980 um right so the gravity threshold then we want the forward velocity and this particular one we're going to change it from float to vector we're going to press another plus over here and we're going to bring in an upwards velocity which will leave it a vector again we then need another variable and we're going to call this rotation torque just like i did before and i'm going to change this to a float because we need a float value for our torque then we need a side torque power and then we need another one a boolean for super speed you can call it super speed okay but we're going to change this to a boolean again we can expose all of these values if we want to if we don't it's fine doesn't really matter but yeah these are the values that we'll be using and with that done we can come compile and go into our event graph so uh we don't need these event take an event action begin overlap we just need our event begin play so to start off with this uh because we've already compiled once we press compile you can actually add some default values to to these uh to these you know variables that you've added so the float will keep it at zero the max um this is debatable because it's really all about how fast do you want your ship to go and this is where you put a cap on it so in this particular case we'll go i don't know a hundred thousand maybe i don't know is that is that a hundred hundred a hundred thousand let's just leave it at that for now then the gravity threshold um we'll put this as a thousand but you can put it to different values and what the gravity threshold sort of does is if you stop your ship does your ship start free-falling or things like or does it just keep floating you know that's that's very important as well um the forward velocity which are vectors and upwards velocity we keep that zero zero zero the forward torque this is um in a or one second i can seem to be [Music] forward toward power i think i've um yeah i've not added one here let me just add a new variable and we're going to call this forward torque power and we're going to set that to a float and maybe i can move it yeah i should be able to move it and this is um just how fast um your ship goes upwards downwards so that's important as well the rotation torque pretty much tells us how fast our ship can can rotate uh and we'll put it to a 40 so that's the velocity of it at 40 the forward torque power um that can be actually rotation maybe we'll do like 80 and then the torque power forward torque power let me just compile otherwise the value will not show up in here maybe we'll do that at about 60 and then you have side toward power and you want to put that so this is how fast the ship moves left to right like rotates left to right not on its not on its uh you know doesn't rotate like that in the scene but rather than just go it just looks left or right so we may want to put that maybe at a i don't know 200 so it rotates quite quickly and then the boolean we just leave as it is nothing nothing there to be done so compile again um now what you want to do is you want to set the thrust and we'll use that to when we press the play button that's when the thrust is going to be decided so what we're going to do if you hold uh control while drag while while clicking and dragging out the first this is set uh sorry this is uh a get thrust we don't want to get it so what i mean by get for us is if you would just bring this upwards and bring it over here you get two options get first or set first we want to set thrust and the uh shortcut for that is keeping alt pressed on the keyboard and then dragging out and that's set first uh we're going to link the begin play to our set like that so this happens when we start then we want the max thrust to be added in as well and this is a this is a set sorry a get so that means control and then we want to put this over into our thrust but we want to first divide the max thrust by a number so i'm just going to you can type in divide or you can put a divide symbol and then you get this operator pin uh we can link this slide like that and then put this into the first and over here the number will put it at 2. but again you can change these values and then your ship will behave differently so that's it for the event begin play we don't need to do anything else with this uh what we want to do now is we want to start putting our first speed so this is you know we're setting up the first but we are now going to create a nose that basically decide what that for a speed is at and for this we're going to look for an input and what we have in here input um we want the input access first now how am i getting this information what you know am i how are you going to see this what if you don't see it you know what if you don't see this input well the input was over into our project settings in our in our input um it's over here it's the first right so if you named this for us then you'll see it if you name this arganian let's see if that works so if you name this organian and then we want to search for it that's the input that's pretty much the organian input right that's that's how it works um so obviously in here i'm just going to put that back to you first uh so we're basically calling that action in here right and and we're going to use that and um and then we're going to link our first variables to it okay um so i'm going to type in thrust and that's then access event that's the one that i want let me just bring it somewhere over here you go you can sort of get these nodes to look nicely after um we then need to bring a sequence so just type in sequence and then we have a then and then so once this sequence one zero happens then sequence one um so we want that in there uh we also want a nearly equal float and this is just going to correct our error for our first and we we will link this over into the a value leave the b to where it is but the error tolerance will put it to zero point one so not point no no no not point one i always get that wrong okay um now we also want to want to get a forward vector of our ship so we can um pretty much declare the that the first speed is what's giving us the forward velocity so we've got the forward velocity as a vector i want to bring that in as a set like that so alt drag it in uh we then want to bring in a multiply so the multiply is either multiply on your keyboard or you can type in multiply and you get this node and the pin connects over into our forward velocity you can see now that the pin has transformed into vector type information um so for that we want to bring the thrust and link it over here so we've now changed this to a from a vector to a float this the in another engine i think this is an unreal engine 5 sort of feature these these calculations these symbols mathematical symbols now automatically change from vectors to float and so on uh if it's possible without you having to get a specific one you know float one or a boolean one or whatever okay and now we want to get the forward vector so you can see in here get forward vector and we want to get the get forward vector from the ship okay and this automatically brings our target which is the ship which is quite nice and then we link that over in here and for the set uh node itself we need to bring our sequence one uh sorry our sequence then one and link it over here and that's pretty much done um now we need a uh branch so we're going to branch out guys we're going to branch out so this connects over into this branch and then i'm going to ctrl d to duplicate this branch and i'm going to connect the false option over into this branch um i don't really need to do this yet but i am going to do it just because we're setting up the super speed as well for our ship and if i don't have two branches here then we won't be able to do it basically this branch will take us to our super speed sort of variant of the same nodes and you'll see what i mean in a second now what we want to do is bring in a not um sort of node as well but this is not the right one i'm trying to get a not boolean okay so this is the this is the one that you want to get connect the return value over into here and then this over into the condition of this branch okay um so we're going to do that and now we want to put the set thrust over here at the end um where's my where's my first over here alt drag it and then connect this like that okay um and now what we want to do is we need to connect our value from here we need a we need a plus operator and we're going to link this into the plus operator although it doesn't seem to be allowing me to do that let me just give me one second first put in a divide and i'm pretty sure you can connect these oh yeah it allows you to connect it over here but nothing seems to be you can't really input a lot and that's because we haven't yet told unreal what we want to do with these symbols so we're going to connect this into the alpha which then let me just break this link and just connect it again you can see now they're okay and now they know it's a float and now i can link it you see otherwise it won't work honestly just just you this is how you have to do it you have to tell unreal engine what you're trying to do before you you can do it but i'm not going gonna link it in that note let me just i like to keep things flowing the right way so i'm gonna put that to number one and i'm gonna put this to number two uh the math behind all of this you know if i go like why i'm doing what i'm doing um i think i think i'm gonna probably be lost uh in trying to explain it to be honest but uh let me just put the first in and connect that and hopefully i'll be able to paint a better picture when i finish off the notes and this lerp we want to bring it into f interp2 so it says here what it does try to reach target based on distance from current position giving a nice smooth feeling when tracking a position so that that's what this node does we can connect this over into our thrust and this lerp we're connected to our target and then we need to bring the first again put this into our current the delta time we need get we the node get world delta seconds and we can connect that over in the delta time and in the interpolate speed uh this is 0.5 now here's the thing about this 0.5 this is how fast your speed builds up uh what i mean by this is if you if you put that at one and you can go from zero to ten in terms of speed then you're gaining speed per second uh for the frame sorry you're getting one speed so you're going from 0 to 10 in 10 frames if you put that 0.5 then it's obviously half of that this decides how fast you're going to be gaining speed um and how fast you're going to decrease your speed okay so this is a nice sort of uh value to work with because it allows you to do to do various things in terms of your ship does it move very fast it does build up its speeding whether it be fast or very slow you know it could build its speed very slow uh and then it can decrease it very slow so you know that's that's uh something to to consider okay now this is pretty much done uh from this point now if i you know just as a test let's just try it out right if i connect this then from here to over here so i'm going to take this branch out for a second and just compile this should work in theory at least at least a little bit so let me just take this blueprint away this is our bp ship so in the um bp game mode as in in here or actually no you know what i'm just going to put it into our project settings so if i go into maps and modes over here um if i then bring the bp ship into the default pawn class i should be able to can i drop it yeah so i dropped it in there now in this within the scene itself by the way i do have um a player start so the player start is over here you can drop one whatever you want preferably closer to the world origin so you don't really get any any problems but if i press play now i should start from here okay so i did um although this is a bit tricky because it's it's loaded the other game mode i'm not really sure why let me just see what's going on because i'm trying to load my oh there we go see the world settings hasn't been changed so i need to go in here bp game ship which is bp ship and if i press play now okay okay so i've got this but nothing is happening right we don't even know if we're moving i can tell you for certain that we are moving and we could go in here maybe put the interpolate speed to five and let's see if that makes any difference so press play let's see am i moving no not really okay that's fine it doesn't matter but this is our this is pretty much our ship now spawning uh with these settings i'm not yet moving unfortunately we've gotta we've gotta obviously uh we've gotta resolve that somehow um okay so what we're going to do now is i want to create a supersonic sort of speed this is why i've got this branch over here okay um and in order for us to do this uh what we're going to do we're going to copy so we need to copy everything apart from this branch over here so that is and any any not this we don't need the sequence and we just need these points with these and this set okay this is what we need so i'm just gonna press ctrl d to duplicate them and then bring them up here now we want to then bring this axis over and connect it just like that and then this one over into the a value just like we did before so it needs to look the same um the the not value needs to connect over into this condition over here and then this branch we needed to go like that okay and then the true value of this branch goes into this set value so what we're essentially saying here is um if i so i'll show you in just one second um wait this condition i need another branch so i need another branch over here yeah i need another branch over here this condition links over into this branch okay just like that the then uh this branch doesn't connect over there but instead it connects over here and then this branch connects into our set yeah just like that yeah that's it okay so the reason why i've done that let me just bring this branch up here so it's out of the way the reason why i've done is because we need the condition to tell our system why is it switching to this version instead of running this version and that's where we're bringing in an input mouse action and in my case it was super sonic if you look in the project settings over into our input that's what i've written supersonic so that's why it's called supersonic and what i'm saying is if the button is pressed or released two different things can happen so then i can bring my super speed set it and then i can duplicate it okay so if it's pressed set to on okay so this is true so then i'm pulling it over into this condition so what i'm saying is if i press it it's true and then it goes to the condition which then branches out into the true value which is then loads up this information if it's released then it's false and nothing happens meaning rather than this going over into the true version it just continues on with its faults like nothing really happened as in if it's false it just goes over into this branch okay and that's our that's pretty much our setup for the supersonic speed which i can then bring upwards like that hopefully hopefully it will it will look right hopefully you understand you know what's been done here but what's the difference between the two you may ask well the difference can then be pretty much changed over here so i can put a 0.1 value meaning that i'm going to get very high speed now again let me just press play here does anything happen it doesn't happen yet because we haven't yet given a forward velocity and i'll show you what i mean in just a second so we've got we set the forward velocity here um and that's fine but we need an extra we need an extra layer which is the velocity and rotation point so this is this is on its own this exists on its own and now you need to set the next sort of stage of it now in for the velocity and rotation i am going to take our event tick so i'm using this now um first thing we want to do is bring in a sequence which you know we we're probably going to use this again so we want the sequence that then branches out so let me just take this then value put a branch and again for the branch we want with this to set our upwards velocity so bringing our upwards velocity if it's true we put it over here and now we obviously got to add some things in there and also a condition um and we're going to bring a den we're going to bring from this from this then option we're going to bring in a set physics linear velocity and that's for our ship then we want to bring our get our forward velocity and our upwards velocity and we want to add these together so the plus sign connect them both and connect them into our new value over here uh you leave this to add to current none of this you don't touch any of this stuff and you just leave it there you don't you don't do anything with it just set the physics linear velocity the way you see it now we can bring our four velocity in here in our gravity threshold as well we then want to take the vector length of our forward velocity as you can see then it returns the value as a float so we're converting that into a float and then we want to put in a less than symbol weight it's called like less it's not less than it's just a less okay um and we can connect that over there and the gravity threshold and then this is the condition that we're going to put in our branch okay uh hopefully i can bring these a bit like that you know just create some more more space um now we want to take these sort of these nodes again these three duplicate them bring them over down here and we want to bring another we want to bring a minus a minus like that oh let me just connect them together okay and this is where we need another lerp and this connects into the alpha of the lerp um let's just leave this like this because we still need to add some more nodes um down here so if it's false if the branch if the branch is false so the condition is false we want actually let me just bring it we want to set the upwards velocity like that and we want to bring an invert v interplay 2 which says in here tries to reach target based on this info current position giving a noise smooth feeling when tracking a position so that's what we're getting there and we need our upwards velocity not a set we need to get it upwards velocity connect that into our current and we need to get a get world delta seconds and that always connects into our delta time we're basically telling the system about the you know to take the fps as a interplay speed to 20. okay and now we need to we've got this lerp in here and uh what we've got we need to connect into we want we want to we want to well one problem that we're going to have in here basically is if you look at the ship so just in the viewport the ship itself you can see that this is the x y and z axis and this is the uh rotation of the ship now what happens is if your ship turns to its side you can see that its accesses have turned as well and that's how the blueprint will read that what we want to make sure here is we want it not to we want the up always to point up and down always to point down sort of thing so we want the axis to always be the same so what we're going to do is we're going to take an unrotated vector okay and we're going to put that somewhere maybe over here let me just bring this set over like that and we need to link in here and a and b so for a we're going to type in get up vector but we want to get the up vector for our ship yeah and then over into the b we want to get get world rotation again for our ship yeah so we've got the unrotate and all that and this slurp which we need to put the gravity of this at minus 980 which is the gravity sort of information from unreal this is a default value um and we want to then add in a multiply node in here bring the value of the lerp and the value of the unrotated vector like that and then that connects into our upward velocity and this should be it let me just press compile we have no errors and let me just press play again see what happens now okay um so that's fine i'm still yeah i'm still not seeing any movements so let me just see what's going on here and now we want to bring our we want to do our move up um sort of parts so i'm going to type in move up that's another axis that we've made if you've made them in the input like i've typed them in and we want to add torque in degrees you can see it automatically loads in the ship which is nice now we want to bring the right vector for our ship um then what we want to do is we've got the um forward to work power so we can get that we then want to put a multiply node in here and connect um connect these two values like that and then we want to bring in a multiply node and multiply between our forward torque power and our get right vector and i'll just put that over into the torque make sure you've got x accelerate change boolean turned on press compile let's see if anything has changed still no change i've gotta gotta work out what's happening here i do get these errors though where it says physics enable if you'd like to add torque so millennium falcon see this is the problem why all right okay so it says the learning function has to have simulation simulate physics enable if you like to add torque oh yes that's right that's what i was forgetting i actually have not added any uh i haven't added yet the gravity to this so this is a this is a part that i've sort of skipped over unfortunately uh but definitely something that we need to we need to find in here uh the options for gravity and make sure that they're they're actually set up as well so when you click the ship itself you've got these um options here on the side uh at the physics tab so you've got simulate physics you've got to put that on and then you've got an angular damping you're going to put that over to one we want to disable gravity um and then leave this the collision here physics actor that's fine um and i think that should be it so let me just compile again um and now if i press play okay now the ship is moving see i wasn't i forgot about the simulated physics part but as you can see we're only moving forwards upwards and downwards because that's the only thing that we've set up so far i can't i can do the shift thing shift just increases speed which is great but i can't i mean the double the w a sorry the w and s work but i can't do anything else other than just just go forward or backwards so let's then have a look at doing the rotation and move left and right so in order to do that this is quite this is quite simple because we can get all of these sort of all of these nodes that we've got here ctrl d bring them down we don't need the right vector we instead need uh get up vector and we put that in we connect that into this multiply but then over here we need another input which is move oh not yet move right i wanted to move right and that was the axis input that i needed so that goes over in there and this value goes over into here sorry like that then compile and now i can duplicate all of these bring them down here again i'm going to delete the get up vector and instead i'm going to put the forward so get forward vector and same thing this connects over here and then in here we're going to bring in our roll roll axis there we go connect that and connect it over here and now press compile and if we press play ship is moving so this is left right you can see how fast that is because that just that's just the torque now i don't really my camera isn't moving very nicely um so what i need to do is go back into here again if you want your rotation to be um faster so you can go to maybe well actually slower go to 50 then the forward torque power maybe go that pull that to 40 so you may want to sort of change some of these things to make it so it moves smoother but then you can select your spring arm over here as well and then you can increase enable camera allow camera like rotation maybe camera lag speed you're just gonna have to look at these settings and choose what you want but they definitely make a difference uh for sure let me just show you what happens when you set up camera lag if i press play right now moving quite nicely you know but then if i start to accelerate this goes further away because of how the camera lag was set up but if i press shift in w it's going baby this is like madness you can see how you can i mean this is this is quite creative actually you can do some really interesting stuff with this camera lag but we obviously don't want that so uh what we do want instead is um we're just gonna have to look at the camera lag speed and and and all these um options maybe let me just try i can't remember now if i need to change this to uh to a lower value or to uh let me just try you've got a max distance so you probably can limit that maybe to a 200 let's just try 5 and 5 and compile press play and yeah okay i think it's a bit too tight now so you've just really got to play around with these settings maybe maybe your max camera is 500 so let me just try now it's still still very tight um so i think if we believe it at 200 we probably need to look at um i mean this was 10 before wasn't it so let's just see what happens yeah i think this is all right you just need to what you need to do now is just push the camera further so you'd select your spring arm and then up here maybe go to a um to a 7 000 instead of 5000 um and then when you press play yeah this is this is further away so that's fine okay so that that's pretty much that pretty much concludes setting up the ship um some tips and this is for feud for the future for a future video but you could link niagara spawn particles for example if you have an engine uh like like jet or whatever coming out of the back you could probably link it over you you'd link it over here so that the spawn rate of those particles is based on this or the luminosity or whatever based on this set thrust here and here so i'm going to show you guys that in a future video but right now let's just put a very basic sort of hud together just so you can get some information on your screen of what's happening when you accelerate or decelerate in your scene and the first thing we want to do is right click and create a new blueprint and we want to type in here widget um and you're going to see this sort of visual okay uh let me just try widget hud yeah there we go so we want to bring in a widget hud but we're going to call this hud ship maybe if you double click it this will open a panel and you can see this is our uh wait one second why is this opening it's a very interesting thing i've got a widget hood over here but this has already loaded up some information i'm i'm not really sure why that would be the case um let me just try and double click it again i think we've got a bit of a problem here so double clicking it yeah very strange um so i've got nothing in my graph but i've got something in my designer i don't know why would you upload this way anyway so what we want to do first is we want to add um a um where is it now so i need um [Music] go honestly this is really i'm trying to get a canvas panel right so there we go okay right so now that's reset so we've got a canvas panel in here uh and then we want to bring another one and this is this is this is our screen this canvas pretty much envelops our entire screen and this is the other one that i've just put at the bottom maybe make it a bit i don't know bigger like that and then you can add a text inside and you can make this smaller so um but you've also got i mean if you're going to make it smaller you've got to make sure that the text size you've got a text try and find the text size in here you got the font so we're going to put that to maybe a 12 or something maybe i don't know 11 and then whatever the text will be let's call this speed for example so that will change the text to speed then we want to duplicate maybe this this node and you can drag it maybe over here and let's just leave it as well actually we can just we can delete anything that's written in there we don't need any sort of text for that and then over uh down here we're gonna need a progress bar so i'm going to try and you know just add a bit of a progress bar we need to then tell it how much this sort of info you know how to link the progress bar to the number over here for example and in order to do that we've got what is called a binding so if we press that button and we say create binding this creates a new binding over into into into here if you press a designer it will take you back to where you were setting up the the hud but if you go into graph this will show you the bindings so you've got get text too um okay and in order for us to sort out the text we've got the return return node over here uh what we want to do is we want to bring a cast to bp um and that's the one the ship one that's the one that we're using so we want to bring that in we want the get text to connect into it like that and then obviously the cast goes into the return nodes just like that we then want to get player pawn and we'll leave we'll connect this over into our object like so this we want to bring the thrust from the blue so that that's that's the information that is gonna it's gonna read the thrust of the ship that's the information that is going to read and display as a text um and then we wanna bring in a safe divide over in here and we want to do text to text float so we're going to put that in there and then like that and then over in here want to bring in a dot no not a dot sorry um [Music] oh yeah you just want to do that actually i want to connect it that way and this should work just fine it's the first strain to the safe divide and then the number in here we can add maybe a 10 000. this is going to be the limit of what it can display so let's just leave it at 10 000 for now and then press compile uh we're getting an error the widget and parent class have a widget hierarchy sorry where is that coming from specifically you know what what if i do bring a dot here i'm pretty sure i had to trick it somehow so now that won't work no it should actually work i don't really understand so internal compiler tries to cast a prof property text block in scope but another object oh already existed all right okay so it's basically interfering with the other it's interfering with the other widget but anyway what i'm trying to say is let me just let me just close this off let me just bring the other one up so what we're trying to do just ignore ignore this point and ignore this point these don't matter so basically what you're trying to do for the get text you're trying to do this that's what you're trying to get okay so if i compile this should work without these points now from what i'm seeing you could connect this directly like that it's not really a problem okay so you've got all these connected this way and then for the percentage you'd go back into your over here right you select the progress bar and you press over here in the button create a binding okay you can change the color of this if you want a different color you can do it to whatever you want um but that's about it really and then once you create a new binding this will take you to this page where you've got um the percent now again don't worry about any of these things these are just me testing around with a different kind of spaceship but for the for the progress bar this is what you want to do this is the value that it can go up to so as long as this value uh equals is the same in this particular case it's either you can put a one or a two or whatever but this value has to come in line with your max thrust from here so just experiment with the numbers depending on what numbers you put in here you will have to go into your widget hud and then change this value and this value over here so that it matches up with your progress bar so the progress bar is not always filled there's a actual build up and then the actual number of speed matches what you are showing on screen and then once you do that you just set up in the um in the game modes or in the well in my case it was in the world settings sorry about that um so it was right here in the world settings what you do um you'd set up the hud to ship hud or whichever one you want but you can set up to you can't set it up in here unless you first got into the project settings so in maps and modes um so in here you'd have to well you bet you you won't be able to see uh that hud unless you've you've added the the blueprint that you've created so in this particular case this bp ship and bp game mode unless it's linked to the widget and and unfortunately the widget that i've just created the one that i've just created doesn't work that because it overlaps with the other one um won't it won't look for it it's looking for the millennium falcon so if you were casting this so let me just try this out if i would be casting this to bp ship instead like that so this object you know do this and let me just copy it over here as well so i'm just quickly trying to show you what would happen oh yeah um obviously i would literally have to get its first make sure that's in there and over here as well i've got a i've got to make sure that i'm getting the first from the new blueprint otherwise it won't work compile okay and now if we look into game mode i can actually select um well still count that's strange let me just go in the project setting i should be able to select it now so bp ship yeah i'm not really sure why it won't allow me to select it unless i actually have to open the game ship yeah very very strange that it wouldn't allow me to select it i'm sure this will uh this would work i'm just not particularly sure why not uh man honestly i am stuck between so many different things now so many different so many different blueprints and blueprint glasses uh this was the ship hud that was trying to open it's compiled oh yeah no this is right okay so this is the ship hud yeah okay yeah yeah this is fine because if i press play now um yeah i need yeah i can play yeah so you see it it's working it's loading that one so it's loading the right one this is the this is the blueprint that we just created earlier so it's loading the right one i just i was just you know obviously having so many so many um so many different naming conventions now but yeah you can see that this is displaying the information and you can see how fast i'm building that speed up because in the actual blueprint for the ship so in here we have the interpolate speed at five so we could put that for example to one and we can put this to 0.2 and then if we compile press play again you can see that i'm barely building up speed now you can see that yeah i'm not building speedy not even close and if you don't press shift and you press w instead your speed will decelerate to reach 10 because the system is trying to push you back put you back at the velocity of 10. so yeah pretty much that's it that sort of concludes our tutorial um as i said if you're a bit unsure about the hud sort of scenario thing just uh ask a question go on the discord channel ask a question in case it doesn't work for you but it should in theory work just fine um i'm just getting an error because i've got an overlap we'll i'll have to have a look into that to see why there would be an error like and i have multiple sort of huds but i'll have a look as to how to fix that problem in the meantime i think pretty much the tutorial is done this shows you how to set up your your scene through house flying spaceship i hope you guys enjoy the content you please leave a like comment and subscribe please some feedback consider buying one of my projects you know buy me a coffee if you would want to support me and you want to get some you know something like this that's already working it's got the ship by the way inside of it so you can fly the ship and all that so you can just pretty much get the project and you're ready to go but i'll see you guys in the in the next one when i'll release another tutorial i'm not really sure what the topic is yet i'm still debating what i'm going to select but clearly space related so i'll see you guys in the next one stay safe and travel with the speed of light we're done
Info
Channel: Arghanion's Puzzlebox
Views: 22,244
Rating: undefined out of 5
Keywords: unreal engine 5, unreal engine space scene, unreal engine 4 space shooter, unreal engine tutorial, how to make a space scene in Unreal Engine, how to make a space scene in Unreal engine 5, how to create a space scene in Unreal engine, how to create a space scene in Unreal engine 5, How to fly with a space ship in Unreal engine, Star Wars in Unreal Engine, Millenium Falcon in Unreal Engine, unreal engine 5 graphics, unreal engine 5 games, unreal engine 5 realistic graphics
Id: jryE6dQV0Yw
Channel Id: undefined
Length: 68min 17sec (4097 seconds)
Published: Wed Mar 16 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.