How to Make a Helicopter Part 1 - in Unreal Engine 5.1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up everyone today we're gonna see how to do an helicopter I'm gonna use this helicopter that is free on the marketplace um so the first thing we're gonna use the vehicle component to do all the control for our helicopter there's different way to do helicopter I found after trying all the ways that this one is the easiest way to understand so we're gonna jump in the helicopter here I'm gonna start my helicopter as you can see I have the speed the altitude see I'm on a flare that I can shoot that my helicopter is on and I have Android health so I can go up with my helicopter I'll be able to go down if I move to the side here using the mass of the vehicle it's going to make my helicopter move in this direction okay so when we're close enough from the ground you can see there are some dust and when I'm very very on the ground I can turn off my helicopter here I can press X and I exit so I can go wherever I want with my character you can go back to my helicopter start the helicopter once again and after getting the speed the rotation that we need so we can go up and we have some flare on the helicopter by pressing space so we have the flare here you can see we have 72 flare remaining and if I press again same thing Adam so we can still go up just gonna land on the top here the control is pretty good let's get some time to get used to it because it's going by the mass it's not just many other games that you just press you know double you and you look after I go forward so it's really important to understand this because basically I could go forward with the helicopter right and if I can even do a back flip if I want with the helicopter here okay maybe not realistic but we can still do that we can do that on the side as well okay we have full control on the helicopter here so using the vehicle component it's going to make our life very very easy so let's just jump right into it and see how we can control this helicopter and make it work well the first thing that we have to do it's getting the asset that we need so we're gonna go to the marketplace here and we're going to search for the Blackhawk and when we have this we're going to import that to our project so if your project is open and you already have other asset I mean other visionnet asset you may have a conflict and it's going to say that the asset is already in your project when it's not so to fix this issue you need to have your project close you should be able to import that your project so we're going to click to add to project here you can type the name that you want so for me I know it's YouTube so I'm gonna put YouTube here and can show all project and everything that has the name of YouTube will appear here I'm gonna use the YouTube vehicle 5.1 if you'll have the other video that I did for the other vehicles and I'm going to put the helicopter in this project now we have the version so we can select this by clicking on the arrow and we're going to use 4.27 and we're going to add to project it may tell you this because I already had that to the project however if you don't have this in your project you should have no problem so we're going to click yes it's gonna put that to my project now we're going to create the blueprint for our helicopter as you can see here if you go under the folder of vigilant content under vehicle you shall have a folder called Wesley uh68 and we have our helicopter right here so we're going to use this asset to do our blueprint so we're going to go back to my stuff here or wherever you want to put your helicopter here I already created a folder for my helicopter and here I'm going to right click here and we're going to do a blueprint class and now we're going to use the vehicle component so what we have to do we're going to search for wheel vehicle component so we have our vehicle Pawn here and we're going to click on this if in any case you don't have this I'm going to show you how to make it happen so first I'm just going to call that BP underscore uh68 so if you don't have the wheel vehicle component is it I'm going to go to plugin and we can search for cast and you have here the vehicle plugin and make sure that you have that in your project so that way you'll be able to basically have your willpen vehicle back to our blueprint here we're gonna go in our blueprint and here as you can see here you know that you have the good one because the parent class on the top right corner it's the world vehicle pound so we know that we have the good one and here we have the name of our blueprint we have the mesh right so we're going to take our mesh here first we're going to select our helicopter so you can scroll down to get your helicopter or you can just type the name so because I don't have too much in that project it's just saying Wesley uh68 so I'm going to select this and as you can see we have the helicopter and we can compile this and now we have our helicopter so the first thing is done there's different thing to do here for making everything work but we're gonna try to go slow here and do one thing at a time to not get too confused we may come back and forth obviously because there's different things that we have to add and I don't want to add Everything at Once here so we're just gonna try to go by stage so it's going to be easier for us down here we have the vehicle movement component so we're going to click on this and this basically it's what will help us to control the helicopter okay so there is different setting here on the side what I'm gonna check here I'm gonna use the wheel friction position from the Legacy one so I'm gonna check this and under the well well we'll set up here we're gonna add three wheels because our helicopter has three wheels so as you can see here we have three wheels so we're gonna add those wheels so we're gonna make sure that we have the vehicle pound selected here the vehicle movement I mean and under the wheel setup we're gonna click on that three times it's gonna create us three index for our Wheels the next thing that we have to do selecting our wheel that we need first we have to get the Wheels here so the wheel class so you can create it manually or just by clicking here on the plus we're gonna create one for the two wheels in front and another one for the wheel in the back so we're gonna click here on the plus it's going to ask the name that we want to give to this so what I'm going to do first I'm just gonna go to my stuff I'm going to put that under my folder helicopter and I'm gonna call this BP underscore I'm gonna put that early for helicopter underscore I'm gonna put the name of our helicopter which is uh 60a and it's going to be the front wheel so I'm gonna put front wheel and I'm gonna save it now we're in our will so we just have a few setup to do here we're gonna try to make our will match the size of this so I already done that so you won't have to search for it so I'm gonna put 30 here for the wheel ridges the wheel with I'm gonna leave that at 20. the cornering stiffness I'm gonna leave that at a thousand and the force multiplier is going to be two the next one is going to be default I'm gonna leave those two next as default and we want this wheel to be affected by break and break and we want also we're gonna enable the uh ABS you don't have to I'm just gonna check it out because I did in the other project and we're not going affect those Wheel by the movement because the front wheel of the helicopter does not move and the axle type here we need to make sure that we use that for the front so that will will be the front of the vehicle so when you have all those setting matching up we're going to compile and we can close this because we won't need it again we're back to our blueprint for our helicopter we have our wheel that we did so the other index will be the same wheel so we're going to select the front and now we're going to repeat the same process but the back wheel so what we're going to do we're going to click on the plus we're going to place that at the same place so we need our folder and I'm going to call that BP underscore early underscore uh 60a underscore rear wheel and I'm going to save that so it's going to open it for us once again as we already did that so it's going to be very very similar so the first thing is the axle type we're going to use the layer one for this one and the wheel is a little bit smaller as you can see compared to this one here you can see there's a big difference so the number that I think find work well is going to be 20. and all the other setting will remain the same here we're going to make sure that it's affected by end break and also by abs and if we want to we can be affected by the steering wheel because usually for that kind of helicopter when you try to turn on the ground this is moving I'm not too sure exactly but some helicopter the front wheel don't turn it's the one in the back so I'm just gonna be clicking on affected by steering wheel we wouldn't I don't think so we're gonna use that but just in case if you want your will to be effective when you turn left or right it's what you have to check here we're gonna compile and we can exit this so now we have all the wheels for our vehicle the other thing that we have to do for our Wheels is selecting the bone that's gonna match this so to do this there's different way to go find the information the easiest way because we're already here I'm going to click on the mesh and here we have the skeleton mesh that we use I'm just going to browse to it and it's right there I'm gonna double click to this I'm gonna make sure I'm under the skeleton tree then we need to select the wheel here so if we go down here at some point we're going to see the wheel so we have the front well I think it's this one here so we can zoom to it there we go so we have the front wheel here and we have the we need the right wheel so it's going to be this one there and the front and let me find it here so I just want to make sure that I do have it here somewhere I think it's a little bit further up right here here we go so what we're going to do we're gonna take the LF underscore front wheel underscore ENT or int which is going to right click on it and I can copy the name bones because it's important to have the good name so we're going to copy this I'm gonna go back to our helicopter gonna make sure that we have vehicle component selected and the front wheel will be the index zero so we're gonna click there and just Ctrl V to paste the name of the wheel that we just selected we're going to go back to our skeleton bone this time we're going to use the other side so we're going to use the front wheel so it's going to be the same thing but we just changed the two first later I'm gonna copy the bone name I'm gonna go back to our blueprint and we're going to copy the bone name right here so now the only one that we have to do is the rear so go same thing we're going to go back to our skeleton mesh here and we need this one here and this one is the rear right here so rear wheel int so we're going to right click on it copy the name go back to our blueprint and we have the ball name I'm going to control V right there and we can compile that so now on our vehicle component we have all the wheels for our vehicle from here we're gonna go down the detail for the helicopter here and we're gonna set up what we need so we have the mechanical here so we're gonna go down here we're not gonna use any curve so the max torque for this helicopter is going to be four thousand so I'm going to put four thousand the Max RPM I'm gonna leave that at 4500 and I'm gonna leave that at 12. this one here the break affected ten thousand okay and I'm gonna leave that at five and six hundred I'm gonna go down a little bit we have the differential type so I'm gonna put that at forward drive it's not really important because we're gonna fly but I'm just gonna put it there and here we have all our gears uh we don't need that many gears for the helicopter so what we're gonna do we're just gonna remove a few of them so by clicking on the Arrow under the next to the index you can delete the amount of gear that you don't need so I'm Gonna Keep four gears there we go zero one two three so I have four gears I'm Gonna Leave the number as this I'm not going to change anything I'm not going to change the setting right after and we're gonna go down slowly make sure that you can follow and here we have the reverse break so when we're gonna press reverse it's gonna break and also go down for helicopter so you can uncheck this if you don't want your helicopter to break and go down at the same time I think it's easier to have this than not adding it um so we're gonna go down here we're gonna make sure that the center of mass is override so we're going to click on this and basically I want that override because in case the mesh it's not centered perfectly with this it should be doing the trick for us so we're gonna go down here We're Not Gonna Change the setting here but we're gonna change the Sleep threshold so we're gonna put that at zero and we're gonna go down a little bit here I'm going to expand the advance here so we have one one one we're gonna leave that as is and now we shall add the Thruster here so we need to add one thruster so we're going to click on the element array right here and you can expand this here and it's going to be a fix for the type and the bone we want to select the middle of our helicopter so because when we're gonna go up it's gonna go by the middle of the helicopter so when we tilt the helicopter forward basically we're going to push from the axis Z here n is going to push from under so we're going to take the truss axis and we're going to put 0 for the first one so we're going to remove that from the X and we're going to go to the Z value and here we're going to put 1. and the amount of force that we want to use well I'm gonna put 40 000. so if this number is not strong enough I mean INF depends what is the mass of your vehicle you may not be able to go up or down so this number need to be quite I I will say depends of the mass that we have for this will capture the mass as you can see here on the top it's a 1500 by having 40 000 it should be more than enough to lift that helicopter so here for the bone name we have to select the bone name for the middle of the helicopter so if we go back to our helicopter here for the skeleton mesh we want the middle of it so if we go all the way up here and we'll go down here we have the Cog int which is the middle of our helicopter or almost the middle of the helicopter so I'm gonna take this I'm gonna add not add but I'm gonna copy the name I'm gonna go back to my blueprint and I'm gonna put the name right there so now we do have our truss right here under the helicopter so we're gonna go down here just continuing to put some setting for our helicopter and here we want to expand the torque here because we're gonna use torque for our vehicle so we're gonna enable the torque and here the scaling I'm gonna put two I'm gonna put zero for the steering because we're not going to use that we're not going to use the roll torque as well the pitch will be two and the torque row would be two and the steering We're not gonna have anything so we're gonna put that zero and the rotation damping we're gonna put one and we're gonna compile that every time you compile sometimes you lose so you have to click back on the vehicle component here um so we have the target rotation here so we're not going to use this so we're just gonna leave it as is we're gonna click on the stabilization or stabilize control so we're gonna use this so we're gonna click that for enable so the old Z altitude it's what's going to help us to keep the altitude of the helicopter to not go up or down too much so we're gonna put 10 here actually sorry I was not looking at the good I'm gonna put 50 and holding the position it's going to be three so you're gonna see later when we play with those value here the helicopter when we stop touching you're going to see that link up that's going to go down depend of the number that we put here so I believe it's the number if is bigger the helicopter is going to drop more before stopping going down I'm not too sure exactly so I'm gonna play with those number and we'll be able to figure it out but those numbers from my testing are working well so we're gonna go down here for the vehicle input it's going to be the idle break input I'm going to put one 10 and 100 I'm gonna leave it as this and we should be good I believe for now now we're going to do the physical asset for this that we need to be able to start moving this helicopter so we're gonna go to the content browser here go in the folder where we have our helicopter and I'm going to right click here on the content browser and I'm going to use the physic here and I'm going to go all the way down and use the physic asset and it's going to ask me which skeleton that I want to use well we want that for the helicopter so I'm going to select the helicopter and we're going to call that pH y s underscore and I'm gonna put the uh 60a and I'm just going to create as you can see here they generate some Physics for us we don't need any of that so we can select all of it so we're just going to remove voila so now what we're gonna do we're gonna make that very very simple so we're going to right click on the wheel here gonna make sure that we can show all bones so we're going to click on that and we're gonna go down here and we're going to select t the middle here so the cockpit and we can create one asset so as you can see here they're gonna ask you what you want to create so on the detail panel on the side here so I'm just going to expand so you can see it I'm going to make that very very simple so we're going to do a box and we're going to add so now we have the box here obviously it's not exactly the way we want because it's selecting everything so what we can do is we can just realign that box if you unclip this you'll be able to go exactly the way you want and you can place it around the helicopter so you can do that that way I want to keep that very very simple so I'm gonna keep it that way you know something like this I'm gonna go to the perspective here I'm going to go to the left so I can have a good view here so I can align my box perfectly with the wheel and the front of the helicopter in the back so we can just put that a little bit smaller and adjust that perfectly like this I think this would be good enough for now so we're gonna go back to our perspective mode so we can see our early copter now we're going to select the wheels so the one is going to be LF as we did before when we were sitting setuping or will and gonna take the front wheel here and this time in the detail panel here on the side instead of a box we're going to use a sphere and I'm gonna add body as you can see here we have one there we're going to repeat the same process but for the other side so the other side is RT and we're going to take the front wheel which is this one there make sure that we have a sphere for the tool another tool but for the detail here for the type that we want and we can click add so now we have that we only have to do the rear so that one was rear and it's going to be this one here so the wheel int same thing make sure that the Primitive type is a sphere and we can add a body now we have our wheels and the body of the helicopter it's really really basic you can play with that if you want obviously but for this video it will do the trick for us so we can save and now we're going to select all of the box that we have here and we need to make sure that the physic type for all of them will be simulate it's important otherwise it's not going to go up and down so we need to make sure it's up so what I'm going to do I'm just going to click here so we're going to go one by one so simulate physic it's there so it's exactly what we want and I think this use Simple Collision it's good I think we're good with that so each of them need to have simulate physic so you can select all of them at once or you can go one by one and put simulate physic so we're gonna do our control to go up down left right so we're gonna do this we're going to go back to our blueprint for our helicopter and we're gonna go to the event graph we can remove all of that because we don't need it for now and we're gonna need some input action to go up and down left right and to roll and all that jazz so we have to create all the input before being able to put some movement because I'm using Unreal 5.1 so we're going to create some inputs so we're going to go to my content browser here already have some inputs here that I have for my other vehicles so we're not going to use any of that so what I'm gonna do I'm just going to create a new folder and I'm gonna put helicopter and here we're gonna do all the action mapping that we need to be able to control our helicopter so first we're going to right click and we're going to go to input and we're going to use the input action right so click on this so the first one will be I a for input action underscore I'm going to put that in the capture and it's going to be move forward and backward we're gonna create another one so right click input input action IA underscore Le underscore move but this time it's going to be up and down we're going to create another one is going to be I a underscore is going to be for the helicopter so we're going to put ili and it's going to be our left and right I'm going to repeat the same process once again and this time is going to be 4 or helicopter to go uh the steering wheel when we turn so because we have the rolling to the side and we'll also have turning so this one will be or turning so I'm gonna call that steering and I Ting or good because we have our roll up and down left and right and or steering so we'll be all good so we can compile so now we're gonna go to the left one and here the description will be reflecting what this is doing so it's going to be our Pro left and right and the value type will be an axis 1D and we can save and exit we have our up and down so the up and down would be very very similar as well so we're gonna name this belly up and down and it's going to be also a Nexus 1D and we're going to save and exit now we'll have one remain it's going to be our steering and our steering is going to be our left and right so we're gonna call that left right and it's going to be also an axis 1T and we're going to compile and Save now if we go to our input we have our four input for our helicopter to make sure that we are able to use our key that we have here we need to use an input and mapping context right so we can create one if you don't have one you're gonna go on input and gonna create an input mapping context me I already have one because I have other vehicles so I'm going to use this one so I'm just going to open it as you can see there's other controls so just disregard those control okay and we're going to create the one for our helicopter so by clicking on the top here for mapping it's going to open this here so we can click on the arrow and select the control that we need so left and right we have to decide what key that we want to use for Iving or helicopter roll to the left or the right so first if you click on the keyboard here I'm going to use a on my keyboard to turn left and I'm going to create another one so I'm going to click on the plus and I'm going to click on the keyboard and click D so A and D will make my helicopter roll to the side so even that to make that a little bit easier to understand here we have our control left and right so what we're going to do I'm just going to rename this and I'm going to add roll left and right so it's going to be easier to remember what this one is doing so we're going to expand those two there and we need to do a little multiplication to the left side so when we roll yes so on the trigger here we're not going to add anything but on the modifier I'm going to click on the plus we're going to click on the arrow and we're going to select negate here because as you probably know when we press a it's minus one and when we press D it's plus one so we want to minus one when we press a so we put the negative if we don't put a negate well regardless of a or D it's going to go in the same direction so it's not what we want so we can save this so we should be all set for that we're going to add a new one this one will be forward back so to go forward it's going to be W for me and to go backward I'm going to click on the plus here and I'm going to click on the keyboard and click s as you know W is plus one and S because s is backward it's minus one so same as the other one we're gonna click on the modifier I'm gonna click on the plus and I'm gonna scroll here and get the negate modifier and I can compile it so now if I click W it's going to be plus one if I click s it's going to be -1 so it's going to go reverse it's exactly what we want I'm gonna add a new mapping here this mapping will be 4 or steering so we have the forward oh we're going to do the up and down actually first so up and down you put what you want I think it's working well when you put the left Mouse to go up and to go down we're gonna click again and it's gonna be the right Mouse okay so you can put what you want but you only have too many keys on the keyboard for your capture because I don't have a juristic so I'm just trying to make it work so using the mouse it's less key that I have to use on the keyboard so here same thing as the other one so we need to go up and down so the trigger here we're gonna click and add to trigger so it's going to be when we press in when we release you know if you work before in Unreal Engine 5.1 you had for your action key you had press and release but now we have to add that here so I'm gonna use this right here and I'm gonna go to the trigger here and I'm going to do the same thing I'm going to add two trigger it's going to be a press and release right here and also we need to add a modifier because when I'm going to press this one I want this one to go backward going down and to go down is going to be a negative value so we need to put negate to go get our negative value and I'm going to save that so now we have row left move forward and backward go up and down and we have one more to do and this is our steering so the steering is just to turn left and right so I want to turn left by pressing Q I'm going to click on the plus here and I'm going to press e so I'm going to be able to turn left and right once again is going to be the same process as we did for the other ones so it's going to be a trigger I mean not a trigger but we're going to have press and release so we're going to click on the trigger here I'm going to click that twice we're going to select press and release and location do also a modifier because Q is a negative value because we want to turn left so it's minus one so we're going to click on the modifier for the array and we're going to select negate and now we're going to go to E here we're going to add to trigger which will be the same as above so press and release and we're going to save this and now we have all our control for our vehicle we have the row left and right deep move forward and backward move up and down and to turn left and right from here we're going to start using the input action that we created to do our Logic for moving our helicopter so we're going to go to the blueprint for our helicopter I'm going to make sure that we are under the event graph here we have the viewport construction script we don't need that and the event graph here so we need to be in the event graph so right click here and we're going to search for our helicopter and we're going to take the steering so we have our trigger started ongoing cancel and complete so we're going to use the trigger because as you remember we use pressed and release so we're going to use the trigger so we're going to drive from that and we're going to add I'm going to add some control and we want to control the ER here because it's going to be or left and right so we're gonna click on this and we're going to make sure that we have that to the cancel and complete and we're gonna drag here and we're going to add our set input so we're going to need to take our vehicle component movement just drag it on the board here you can drag from that and set we need to set our input and we can put it right there so the value that we want to change is going to be our action value here so the control for the uh and the set input we're going to connect that both now we shall be able to turn left and right with our helicopter you know no more code to require because the vehicle component is going to take care of that for us so we're saving a lot in the code here by using this method uh no now we're gonna do the control so we're going to search for or illi once again and it's going to be our roll left and right so we're going to take our left and right right here and same thing we're going to drag from trigger we're going to add control and we're going to take the roll gonna make sure that it's connected to cancel and complete and we're going to connect the value to the action value right here and same as we did above here we're going to take our vehicle Movement Company I'm gonna drive from that and I'm going to set a roll input and I'm going to connect this to the action value like this and we can compile now we're all done so just before forget so what we're gonna do we're gonna select destroying here press C on our keyboard to do a common I'm gonna put control and I'm gonna put left and right and what I'm gonna do here I'm gonna put that green because I know this code is working so green is going to tell me that I don't have any error when I'm gonna play in that code here because it's green not because it's green but I know the code is working so if there's any problem I know that it's not going to be there so I'm using it's just a color code to make that a little bit easier I'm gonna click here on the show bubble so we can see that on the top here we're going to repeat the same process for the one below so we're going to put control and this one will be our left and right so left and right actually I did a little mistake here I just saw that just gonna put the green color here I which was the steering here so I'm just gonna put steering this is the roll so it's going to be a pro left and right and we have our steering here we need our up and down so we're just gonna dry here and I'm going to search for our helicopter I'm gonna take our up and down the up and down same thing we're going to drag from that here it's going to be a little bit different the up and down so we need to create a value so so we're gonna drag the action value right here and I'm gonna promote this to variable and we're gonna plug it to the trigger cancel and complete we're gonna all be on the keyboard to do a branch and I'm going to plug those two together we're going to drag from the value here and we're going to search for equal and if it's not equal to zero we're going to plug it right here and from that we're going to so if it's true I'm gonna dry from that and we need another variable to our player altitude so to get our player altitude what we need to get our actor and we need the location of our actor and we're going to click on the return here and we can split the structure because we only need the Z value because it's up and down so we're going to drag from this the value we're going to promote this to variable and I'm going to plug it in true here we're going to use that a little bit later when we use the animation and here we're just going to rename this value here it's going to be player altitude so it should look something like this so we're going to connect I'm going to connect select all of that create a comment by pressing C on the keyboard and this will be our control up down same thing I'm going to put that green and now we have one more to go and it's going to be or forward so we're going to click on the board here I'm going to search for ili I'm going to take our forward and backward same thing I'm going to go from trigger and I'm going to add control it's going to be our pitch gonna make sure that it's on cancel and complete and Ox also the action value we're gonna take as we did before the vehicle movement component I'm gonna drag from the vehicle component I'm gonna accept pitch input and plug it right there and the pitch need to be connected to the action value right here we're going to select all of that press C to do a little comment and this is going to control or movement so control movement four and backward I'm gonna put that green as well and I'm going to click right here to have the little bubble on the top there we go so now we have all our controls so we have our steering which is left and right we have a roll left and right we have up and down and we have our movement forward and backward from here we're going to we're going to add the helicopter to the map so if you go to your map here and you take your blueprint for your helicopter and you can put it right there we're gonna make sure that the other buses player will be zero on the detail panel here so it's going to make us start with this helicopter if we do play you can see that we're under but if we take control of the helicopter you can see that our control are working okay but we need to modify the camera because now we are looking under and it's not what we want I'm gonna go back to our blueprint go to the viewport and with the mesh selected we're going to search for our spring arm and with the spring arm selected we're going to add a camera so the spring arm we're gonna put we're going to change the value of the target arm here by we're going to put two thousand so it's going to bring that way back I'm going to put a offset on the Z value for the socket offset of 500. it's going to bring that up here and we're gonna go down here and we're going to use control panel rotation it's important you can put your on it and it's going to tell you exactly what it's doing for you so we're going to go down here we don't run the row so we're going to remove this I don't want the spring arm to be afficted by roll so we're gonna uncheck I'm gonna go down here and component this it's good we're gonna put some camera lag because I believe it's it's optional but like it just look better in my opinion so it's why I'm putting this so we can compare this so now we're gonna go for the camera I'm gonna check the setting for the camera make sure that everything is fine as well so now we have our camera here but we want the camera to have a little inclination so we're gonna go here for the rotation I'm going to put -10 so the camera is going to point down so it's giving a better View that you can play with this number if you like something else now on the spring arm one more thing we have to put the location at 140. this one's going to bring this up like this so we need to change that otherwise you may clip through the floor and the parent socket will be more Cog underscore int so it's going to attach the camera to the middle of the helicopter and we can compile and from here if you try it uh it's not gonna work yet some movement will work but it's not going to work it's not gonna fly yet because we still have some controls to do here so we're gonna go for the event tick and here we're going to do the logic that's going to make our router speed turn so the um the two rotor so this one here and this one here will update the animation so by using the event tick and we're going to have the good value to it and at the same time what the event tick will be able to use or action value that we set up here and the player altitude actually the action value I'm just gonna rename that action value up down just so we know what it is exactly so we're going to go to the event tick here I'm going to start the logic so we're going to drag from that and here we need to set our roller speed uh the rate for or rotor speed at which rate we want this to turn in the animation graph so what we're going to do we're going to take um a variable we're going to create one so we're going to trade it so we're going to call it main router speed rate and we're going to set it so we've just drop it on the Arrow it's going to set this for us I'm gonna drag for the main router here and I'm gonna search for thin enter which gonna make the transition between the number smooth so it's gonna look better it's not going to be Snappy so we're gonna the current here it's gonna be our main router rate speed the target would be 25 and the dead tall top proof the Delta time would be get world and we're going to take the Delta second and the entire speed would be 0.2 so if you put your cursor on it you can read what it's doing but it's just helping the transition between the numbers to be more smooth so it's look just better because it's gonna affect our rotor so we don't want that to be Snappy go on off on off so we want that to let's go faster or slower we just want that to go slowly changing to the new number it's why I'm using this so here the main rotor speed rate we're gonna go there and we're gonna drive from that and now we need a new variable which we're going to create so we can go here on variable and we're going to search not search but type Main broader speed and we're going to take that and just set it I'm going to make a little bit of space between so we're going to do search for Plus and we're gonna plus the speed of the rate Plus the rotor speed which is going to give us or roller speed basically and we're gonna drag that to a branch again all be on your keyboard to do a branch or you can just search for branch and the condition will be greater so we're going to search for greater or equal and it's going to be our speed rate so we're going to take that do a get and just plug it up here and it's going to be 15 so if it's greater than 15 it's mean that it's going to be true so we're going to go up and we're going to be able to do overring mode later and keep our altitude but if it's false so we're going to go from false at this time and what we're going to do we're going to set I'm going to set our throttle so just search for throttle so if you select troll it's going to give you automatically the vehicle movement component which is right here and the throttle it's going to be our action value here so the action value up and down you can just do it get and put it right there and we can compile now for try you're gonna see something is going to happen but it's not gonna work quite yet but we can just try it out so you can see so if I press up you can see that the helicopter is going up and slowly going down okay so if we do that again you can see that we can go on the side it's kind of working right now a little bit not quite good yet but we're getting there so we can see that there's something happening but because it's not all done obviously it's not working very very well so we're just going to select all of that and I'm gonna do a little comment on this and this will be I'm writing up so it's going to update the location the altitude and the control of the helicopter okay in real time there we go so now we're not done but this we're going to have more code to put there but for now uh we're gonna start with destitute now we need a function to keep our altitude so when we go up with the helicopter it's need to be able to keep the altitude we don't want the helicopter to start falling down so we're gonna work on this so it's going to be very very simple so we're gonna right click and we're gonna create a custom event that we're gonna name key altitude and from that we're gonna drag and we're going to set our throttle for our vehicle movement component and the throttle we're gonna drag from that and we're going to search for a map range clamp and the range a will be zero and the range B would be 10. and I'm gonna put 0.7 there and here this one is going to be seven so as I mean zero you're gonna see when you move this number it's gonna you it's gonna basically make your adapter drop lower or faster not lower or faster but you'll see when we play with this number I don't know exactly how to uh explain that so we're gonna do a minus here from the value I'm going to take our player altitude and we're gonna put it right there and now we'll just have to get our actor location and we're going to split the structure from their return value because we only have concern for the Z value because it's the up and down we want to keep the altitude for the up and down we don't care about the two others so now if we compile now we have our function so we can select all of it t d altitude it's going to keep that constant when we are releasing releasing the control up and down so we're going to move depth right here I'm going to change our color because we're not going to modify anything there so now from our event tick update we just need to put that keep altitude so if we go down here at the end we have our branch if it's true that were or roller speed is above this it's mean that we want to keep our altitude so we're going to drive from that and we're just going to search for keep altitude which is going to trigger this here so that's giving a shot see what it does now so we're going up and for release so technically keep the altitude as you can see now it's not going down I'm gonna have to change the camera here because we don't want the camera to do this we just want the helicopter to do that so if we go here so now we see that the keep altitude is working for us which is great now we're just gonna do the view around the helicopter so left and right and up and down so we're going to use uh two key to do that to action mapping I mean so we're going to go to our content browser B it's already created because I'm using other vehicle in this project so it's already there but if you don't have it we're just gonna create that together so you can just right click on the content browser go to input and input action the first one will be your ia3 look that you're gonna name and the description will be our free look and the value type will be an axis 2D and you can save the next one we're going to do same thing so right click input input action n is going to be our free look key that you're gonna name it IA underscore free look underscore look something around those line the type the value type will be a digital ball and obviously the action description would be three loop key you don't have to put anything there but I like to put something so value type digital Bull and the trigger will be old and release so you can add a trigger by clicking on the plus next to your array element and it's gonna give you access to old and release that you can select down here you can save and exit that now we have to go to the action mapping or mapping context so it should be this one here and when you're there you click mapping and you're gonna add the free load key for me I did put left Alt with no modifier I'm gonna click again on the mapping on the plus and we're going to select the Ia free look and this time it's going to be the mouse XY 2D and it's really important here that I mean it's important but I mean not on this one on the free look key here we're going to add a trigger and the trigger on the free load key will be old so we're just going to click old so we have to hold the key to make this work so we're going to go back to our helicopter here and I'm just gonna Implement those it's gonna search for look I'm gonna take the Free Loop Key and again I'm gonna search for look and this time I'm going to take just free look so from the freeload key here we're going to add control I'm going to take the pitch control that we need to add so we're going to take this we're going to plug it to trigger and cancel and complete the value will be this one here you can see we cannot connect it right now so what we're going to do we're just going to create click on the free look here right click and you can split the structure so the value that we are interested in it's y for this one and from the free look here we're just going to add the control and it's going to be the yaw control and the value will be the X right here and complete and cancel right down here the problem that you may see is that the camera is going to go very very fast so let's see let's play and you see when you go around it's kind of fast I didn't feel old Alt same thing right like you see that it's kind of fast and we don't want that so well personally I don't want that I think it's way too fast so what I'm gonna do is before the value I'm just going to divide this by two full boat and I'm just going to connect that right there I'm going to duplicate this one and put it right there so now you're gonna see a difference when you turn around it's much slower so it's just easier to control with your helicopter and I just noticed that when we hold alt it's not responding very very quick so we're just going to go back to our mapping context here then we're going to expand the index you see the old time it's 0.1 we want something faster so what we're going to do we're going to change that value 4.1 and now if you try it as soon as we hold alt we can go left and right but you can see we can go on the side as well we just want to be able to I mean we can go all around but we will uh when we hold alt and when we don't hold it we can just only go left and right it's just easier when you control your helicopter I find so so we go up now when you see we can stay in the air so we can control our Chopper and it's easier because we are able to move so you see now we can only go forward and backward the view is doing that it's not what we want so we're just gonna fix that as well see ins it's in our spring arm we don't want to be pitch I believe so let's try again oh there we go perfect uh it's feel way better now yep way better perfect you see we have a good control on our helicopter so it's doing pretty much of the video of the beginning it's not perfectly there yet but we have a good control so we have some stuff to uh make better but we kind of control the helicopter now so that's pretty good yep what kind of there we go it was good anyway so we're good with that so we're just gonna do a little comment on this here and uh this one will be our control for free look so I'm just going to select all of that gonna press C to do a comment and I'm gonna call that control and it's going to be free look and I'm going to take the same color as here so I'm just going to copy that and put it right there there you go perfect now we're going to create the animation blueprint so when we go and control our helicopter the rotators will move as well here in our folder for helicopter I'm just going to right click gonna go to animation and do an animation blueprint we're going to select our helicopter that we have right here I'm going to create that so we're going to call that ABP for animation blueprint and underscore is going to be for our uh 60a and we're going to open it here we're going to go to the event graph we have the update animation so we're going to search for even blueprint beginplay and here we're going to cast to our blueprint underscore uh I'm gonna take our blueprint for our helicopter because we need to access some variable we need to access those um two variable here the Rotator speed and the Rotator write speed so it's why we are casting to this so we are able to access those variables after so here we're gonna drag from the object I'm going to try get pound owner and we're going to drag from the blueprint and we're going to promote this to variable so now because we have a reference to our blueprint we can use it Down Here Without casting each time so we're going to drive from the animation blueprint and we're gonna is valid and the class will be not this one here so we're just going to remove the try get pound owner and we're going to take our as blueprint for our helicopter and I'm going to plug it right there now we want to access our main rotor speed so we're going to get our main roller speed and we're going to set some variable here so we need to create three more variable so we're going to create those variables now so it's going to be ABP main roller or no underscore that's what we find just ABP main rotor and this one will be the z-axis which is our it's going to be our here and it's going to be type float I'm going to repeat the same process it's going to be ABP underscore no underscore sorry RPM and we're going to repeat the same process again it's going to be ABP and this one is going to be the rear rotator and this one would be the X roll and I think we're good with that so now from is valid I'm going to take our main router we're going to plug it to is valid and we're going to plug this one there so every time that our main router in our blueprint get updated it's going to update this one in the animation blueprint as well so now we're going to take the rare Rotator we're going to do the same thing I'm just going to do a set and I'm going to plug that right there so same thing is going to happen with the rare rotator so we do have it here so we don't need anything else down here so we can just compile now we're going to go to the animation graph and here we need our mesh space reference pause but before doing that look at the top here the parent class it's say anium instant but we need the vehicle any instant that's really really important otherwise it's not going to work so here we're gonna change the uh parent class so we can go to file and repair and blueprint you can just click there and now you can select the vehicle pound so vehicle animation instance so we're going to take this and now you're going to see that the parent class on the top here has change which is going to give us access to what we need to continue the animation with our helicopter here so we're going to search for mesh space version pause I'm gonna drive from that I'm going to take our wheel for the vehicle so we're going to take will control for weld vehicle and drive from that I'm going to search for transform I'm going to take transform modify bone we're gonna need that twice because we have the main router and we also have the rear router but we're going to set up this one first so we won't have to do it twice so we're going to split the Rotator here I'm going to split structure which is going to give us access to the value that we need so we need the Z axis so we're going to take variable I'm going to plug this to rotation I'm going to click on this and now here in the bone modifier it's going to be or roller so we're going to search for roller and it's going to be or ENT so the first one that you have here it's gonna be all in here but we're gonna add the rotation here we're going to add to existent and we want the bone space not the component space so bone space and now we're good with that so now we can take this one copy paste and this one instead of being the rotor we're going to take the rear roller so it's going to be the first one here all these settings should be all the same because we copy the previous node and from there we're going to take our rare and we're going to plug it to our X let me get a little bit of space here and now we can just plug this to the output pose and we can compile now automatically it's going to update everything for us so it should be good and from here we'll just go back to our blueprint I'm going to go click on mesh and we're going to select the animation that we need so we're going to select our ADP I'm going to take the one for our helicopter and compile and now you can see it's starting to move all right we have a little bit of problem with our control there's something that doesn't work we can go back up but you can see that the router or working okay so let's fix the control so we are going to remove this because we won't need it there so we're going to add a new branch and we're going to connect true and that Branch here I'm going to remove from false and here it's going to see if it's equal I'm going to put equal equal and we're going to take our action value up do I get put it on the top here and so this is It's false it's going to go there and if it's true it's going to go there so let's try it out so let's play so we can go up I'm going down go up go down you can see the trigger on this side at the same time which is pretty good right here so we're keeping altitude right now so we can keep altitude and as soon as we're going to press it's going to go to the other one can go up and down perfect so every frame it's looking for a rotator make sure that we are at 25 and it's going to add the rotation speed the rate under addition speed is going to set our speed and if it's above 15 it's mean that it's going to be true we're gonna be able to go up or down and if we are at zero let's mean that it's true so it's going to keep our altitude okay so when we press let's mean that our speed is going to be above 15 not 15 but it's going to be above zero here which one two three and so forth which is going to make us go to the trial also going up because it's going to be false and if we release the key well it's going to be true because we're going to be at zero so we're going to keep the altitude so when we try this out and we'll put that right there so now we can go up and we can go down and we'll keep the altitude and we can go forward we can turn to move our camera at the same time it's pretty good it's hard to control what we're not used to it but it's pretty good so far so we can land down perfect so we see that our control for helicopter is working pretty good she'll have something like this it can be complicated to do obviously but hopefully you were able to reach the final step here with me so I believe that's going to be it for now there's other stuff that we'll like to show you but I think we can do that in another video because this one has been quite long and it's quite exhausting to do all of that but we can see that the vehicle is working there is one more thing here that I wanted to shoot I spoke about a little bit earlier in the keep altitude the number here so if you change a 0.742 for an example where it is okay right here any compile you're going to see that there's a difference when I'm gonna release the key I'm going up and reduce the key you see the time it's take to go kind of go down see take a little bit of time so if you change that in you put 0.1 you see the helicopter really go down doesn't even stop right so we need to change this number right for something so I found that 7 was working well but I just wanted to show you that because I spoke about it earlier in I think seven it's quite good now we're just gonna add the mapping control that we have all our control for our helicopter so as I forget to put it earlier I'm just doing an addition to this video to make that happen so under the world setting here on your detail panel if you don't have access to this you can always click on window and add the oral setting you see that you have the game mode that you want to use and here you have player controller class which is my controller which referred to this so what you can do you can just click here I'm going to click and I'm gonna add this control there so I'm going to add a blueprint and you can see here we have the player controller so we're gonna click on this and you're gonna name It Whatever the name you want and you're gonna open it and when you open it you're gonna start with the even begin play and from the even begin play you can put a sequence if you want to and you're just going to search for add mapping context and here on the mapping context you're going to select the mapping context that you created to have your control for your helicopter or if you've any other contacts make sure that you have your helicopter control in it so we're going to select this one there and now when you start the game by default it should be a disk controller which is going to refer to those input and you will be able to use the control for your helicopter that you have right here so it should have backward forward up down left right for roll and you're steering don't pay attention to the other one it's just that the project that I have there is further ahead than what I already showed you so that's pretty much what you have to do to use your own control and you should be able to control your helicopter so I guess it's going to be this for this video because everything seems to work so we can control our helicopter pretty well you can even break so yeah it's working I'm satisfied with that so yeah just a matter of learning how to control the helicopter and you should be fine but I will leave you on this and uh we'll see uh what kind of video I'm gonna do after this one to continue a little bit for the helicopter so thank you for watching like And subscribe and I'll catch you on the next one
Info
Channel: Unreal By Yourself
Views: 5,616
Rating: undefined out of 5
Keywords: Unreal Engine 5, Unreal By Yourself, Unreal Engine Beginner Tutorials, how to use unreal engine 5, how to learn unreal engine, creating video games, unreal engine series, Is unreal engine worth it, health, Widget, Enemy, Blueprint, Master Blueprint, Options menu, Settings, Shooting, Reloading, sounds, physical meterials, materials, Item pick up, Weapons, Aim down sight, Flashlight, flashlight, Recoil, Gamemode, difficulty, series, Helicopter Tutorial, How ti make a Helicopter in Unreal Engine
Id: M3txxOEkcnI
Channel Id: undefined
Length: 74min 13sec (4453 seconds)
Published: Tue Apr 25 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.