Using MORPH TARGETS in Unreal Engine for Suspension animation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone today I'll do a user requested tutorial on how to rig this sci-fi landing gears on this improvised spaceship using morph Targets in Unreal Engine 5. this spaceship has this four landing gears that are animated based on the height that you're trying to land they adapt for example you can see that if you're Landing from the same position they're extending all the way but if you try to land a little bit lower they just extend the needed amount to hit the ground and I'll now move over some obstacles and now you can see that each of these landing gears is adapting to the terrain below one of my viewers contacted me and said that he saw the rig for my rear suspension of the bike and said that he wants to recreate this effect in his spaceship landing gear [Music] I found this free back on the kid bash 3D website you can go on this Minerva link and then down here you can see that you can get this kit for free it includes a lot of sci-fi meshes here and this landing gear is just one of them near the end here it is this is the model that I'm using it's exactly the same landing gear so export this model we try to click as detections and Export and save it as fbx I already did that and I'll now show you how to do this in Maya but you can do it in every other 3D software I'll put in the description the name of all commands in blender so you can easily find help if you need to know how to do anything of the shown workflow here in blender because the viewer that wrote me for this tutorial said that he's using blender that's why I'm trying to include all the information that he needs let's move to Maya and open a new scene import the model that you exported from unreal just drag it here it comes with four meshes for the four LOD levels and one additional mesh for the Collision box you don't need that for now I'll just delete it I work with the highest level mesh I'll delete everything else I'll unparent this and I'll delete this I have this landing gear imported now and just single mesh to work with I'll move the mesh that way that it sits in the X Y plane you will need a little bit of planning let me show you the final result for this mesh in unreal to explain a little bit better what we're going to do if we go to the skeleton you see that we have two morph targets imported here one for the top suspension [Music] and one for the bottom suspension and they are being controlled by our animation blueprint according to the rotation of our bones to animate let me just explain what you need to do I've done this extremely detailed graphic as you can see this is our landing gear this represents the top part this is the bottom part so this yellow part is this top rectangle here and the gray part is the bottom one and the other two items here supposed to be the suspension arms for the top and the bottom you'll need for the rig some bones for rotating the actual landing gear parts and they will control the movement of the suspension first Mark these points on your model where you want everything to be connected and where your rotations are pivoting and we'll create locators for this in blender they're called empty and then after you have this part we'll use that to rig our model in Maya we'll save three meshes that are the base state that you want your object to be when it's in the resting state so nothing is rotated and moved then you want just the top suspension arm contracted everything else in the model will be the same and then one where the bottom part is contracted and everything else is the same and you use those two items to add as a blend shape or a morph targeting Unreal Engine or shape key in blender to this base mesh and after that when you rig it and then import to Unreal you can have your animation working this needed because these suspension parts are not moving according to the movement of our bones and otherwise you'll need to have some Physics simulation in unreal with constraints how these parts are going to move and your wasting calculations and additional CPU Cycles just to run this kind of simulations and actually you don't need that you can pre-bake your animation in morph targets and use those only based on the movement of your skeleton arms okay let's start doing that in Maya first we'll start with marking our spots with locators or empties in blender in order for our reading later to be easier okay go back to Maya and now I'll split this model [Music] separate ones that way it will be easier for me [Music] all these parts will move together so I'll combine them to a one mesh same goes for these parts combine them to one mesh two these parts as well this is our top arm of the landing gear combine everything here as well and this our bottom arm [Music] it's just single piece let me see if something oh we have this [Music] parts that needs to be combined too bind them as well what's this this part this part of the top and this is the bottom I have separated the model into these parts this bottom suspension parts [Music] are the same as the top ones so I'll just delete the bottom ones and I'll use the top ones instead first let's mark the places that I showed you on the diagram here let's create a locator [Music] snap it here to the middle where the rotation ax is for this should be I'll change the color of the locator so it's a little bit easier to work with I'll duplicate this locator I'll move it here to the middle of this part I'll snap it to the center I'll snap this one to the center too I'll make a third locator it will be the center here snap to the center again I'll make the fourth one it will be in the middle of this part here snap to this and for the last two I'll need the two places that they connect in the middle as you can see this one and this one for the first one I have it here let's show the rotation axis duplicate this locator snap it here snap again to the middle and the last one will be duplicated and will be here the top part of this plate here that it's holding the two suspension arms these are all our locators done [Music] now let's snap our pivot Points for each object to the proper locator this one is the last one so every object is now rotating properly based on the Pivot Point that you placed on the respective locator and for the bottom suspension we'll just duplicate those later in order for our rig to work best and to be easier with our constraints later we need to put these parts on the Zero coordinates on our scene and Orient them to face one of the axes directly so they are not like now diagonally they are just facing one of the axes the easiest one for me will be the y-axis pointing up so let's place this object in the middle of our coordinate system at zero zero point and then rotate it face exactly on the y-axis I think this is fine when you have it dialed in freeze the Transformations so everything is zeroed in order for the translation and rotation and all the scale values are set at one do the same now for the top part of the suspension snap to the middle of our coordinate system and then rotate it exactly to face the y-axis [Music] this is fine for this part as well so freeze the term Transformations for this part too now you have both of the suspension Parts exactly in the middle with all the values Frozen to zero zero this is the easiest way that we are going to create our constraints later so make sure that for these parts of the suspension they're facing directly to the y-axis and that there have zero coordinates for translate and rotate now let's continue with the creation of our skeleton in blender this will be called Armature let's show these parts to explain what we are going to do we're going to create these parts here so this arms of our skeleton will control the movement of our top and bottom part of the landing gear so we'll have one root bone where our coordinate system starts then one bone will start here for the top part of our landing gear one bone for the bottom one that will start here and end on the tip or bottom our skeleton will look like this [Music] I'll hide this and I'll create it start from that center of the coordinate system create joint snap to the center of the coordinate system then snap [Music] to the top pivot point for the top part of the landing gear then snap to the pivot point of the bottom part and then snap to the end of your the tip of your landing gear and this is our skeleton done let's rename our joints in order to properly our locators with these bones we need to parent them properly each on onto the corresponding Bond so this last locator here for the tip of our bottom landing gear will be parented under the tip joint this one will be parented under the bottom all these three will be parented onto the top bone because they are moving with top bone and this one will be parented just on the road bone so if we move our whole skeleton it moves with the model so now what you need to do for the suspension I'll duplicate both of these objects so we can use one for the top and one for the bottom so duplicate them and hide the extra ones for now and we'll start with the top one select the locator that will have our top part of the suspension fixed then select the top part for your suspension and create a point constraint you don't want to maintain the offset that we have currently we want to move the part to the location of our locator so uncheck the maintain offset and make sure that your offset is set to zero and that you're constraining all of the axis to the point of the locator so when you add this constraint for your object it will move to the place where you have your selected locator then select the locator that you want two to point at with your top part of the suspensions in this case will be this one you can see in our diagram the top one is connected to the top suspension here so select the top one select this and use an aim constraint it's called track to constraint in blender again make sure you don't have offset everything is set to zero maintain offset it's unselected and you constrain all the axis for the rotation so when you click add or apply for this constraint it will Orient your part of your suspensions to look at this locator that you selected so do the same now for the bottom part select this locator select this part and add a point constraint it will move to this place then select this locator where you want to aim then add aim constraint and now you'll notice that when we move our suspension our landing gear skeleton that our suspension is working properly do the same now with the other parts for the bottom one unhide them let's start with the top ones add a point constraint here Okay so add an M constraint to this one then select this one at a point constraint place it here and add an M constraint to look at this bottom locator and now you'll see that when we move our [Music] suspension everything the way it should this is the setup that you need for animating these parts now what you'll need is to create these three objects that we have here the base one the one with the top suspension contracted and the one with the bottom suspension contracted to have two morph Target values you'll need to have two models where only the part that you want to be animated with this morph Target is changed from the base model to the one that you're adding as a morph Target so for our top contracted morph Target we'll just make our top suspension contract and for the bottom one we'll make our bottom suspension contract in order to have these three models we need this top part two times extended we need the bottom part two times extended and we need one time the top one contracted and one time the bottom one contracted and we will just need three times the same shape for the blending gear to do this you just move your suspension to the point that you want your morph Target to end for this model if I unhide these parts and if I parent them to the bones here to be easier to visualize so I'll parent this to the top bone and I'll parent this to the bottom ball so now if I animate my skeleton everything is working as expected [Music] and for this model from the Minerva kit bash 3D kit I noticed that this top and bottom bones can be rotated maximum to 30 degrees and this is where you start to have your geometry colliding with each other so this will be our max value 30 degrees for the collapsed parts and zero for our extended part let's start with the top one just rotate the top part 30 degrees so this is fully contracted duplicate these top parts and we'll delete this constraints and now we have the top part done let's combine it select the top and then the bottom the order that you select your parts when combining is important because for the morph Target to work properly you need to have all your vertex information the same for each object so make sure that you always select them in the same way so select the top select the bottom then combine them then delete the history and I'll hide it for now let's return to the zero let's make the extended part for the top so duplicate those delete the constraints select the top one select the bottom combine them delete the history and hide them now let's do the bottom ones let's first create the contracted part select the bottom bone contract to 30 degrees duplicate those delete all the constraints combine them delete the history and hide them now let's do the extended bottom part duplicate delete all the constraints combine delete history and hide it we'll need those parts as well the top one and the bottom one duplicate them on parent from our skeleton and 12. combine them as one object let's hide it so this rig that we use to create everything let's save it by hiding it and if we need it later we'll just have it in the scene but for now let's use our duplicated parts as I said you need the extended Parts twice so duplicate the top extended suspension ones and duplicate the bottom ones duplicate this part three times and now you can see that we have three times this landing gear part two times our top extended two times our bottom extended and white one time for the H1 contracted let's start combining all the parts let's start with the basic shape start with the top suspension bottom suspension and then the landing gear itself combine them into one mesh delete the history and hide it this will be our base mesh let's call it landing gear base then start with the next one where we have the top contracted the bottom extended and then the landing gear as I said the border that you select everything is important so start with the top then the bottom and then the landing gear combine them delete the history [Music] and call this top compressed let's hide it and then start with the top one bottom one and then the landing gear the same way as you did before for the last one combine them and call it bottom compressed [Music] now select the two parts where you have your suspension compressed then select the one that you have as a base mesh and add a blend shape deformer in blender this will be called shape key and now we don't actually need those I'll not delete them for now but just hide them and you'll see that in our base mesh we have this blend shape added with controls for our bottom compressed and top compressed blend shapes we'll use those in unreal as a morph Target in our rigging so let them be at zero and we'll now rig them to the skeleton that we created earlier I'll keep this one so we have the rig that we did before with the constraints and I'll just duplicate it I'll delete all the locators and the meshes that we parented before from the new one we'll just have the bones unhide them okay this is our skeleton and this is the object that you want to rig select the root of our skeleton select the object and then bind this object to the skeleton now you'll have to paint your weights which bone will control what vertexes on your model because now you can see that it's just a like a jelly all around let's start with all the bottom parts of our landing gear this should be mapped to our bottom bone I'll put the values as as one everything else let's hide the bones everything else should be connected to the top bone except this top suspension which will connect to the root bone to deselect this top suspension and both the bottom suspension and the top arm of the suspension will be moved with our top bone so add one for all those vertices and now for our top suspension will have everything here parented to the road ball all our parts of the top suspension and will do them to fully controlled by the road bone that's because we don't want this part to move when we move our top suspension over our bottom suspension we want it just to compress with our morph Target and the bottom suspension will actually move with our top arm and will compress based on our Morse Target now if I rotate the top bone you'll see that everything is moving with the top bone except for this top part but it will be controlled by the blend shape so if I rotate this to 30. and then [Music] use the top compressed blend shape you'll see that it moves properly to the same place if I move the bottom arm of the skeleton to 30 and then I use the blend shape for the bottom compression you can see that it's working the same way let's have them at zero let's have the rotations here to zero and this everything you need to do in Maya you have your part rigged and you have your blend shapes saved here and controlled by this value from 0 to 1 now just export this as an fbx file and we'll import it into unreal where we will continue with the process of setting distance that you want to be landing this particular landing gear let's continue in Unreal Engine import our part it should contain the skeleton and the mesh that is skinned to the skeleton and here into unreal check the skeletal mesh checkbox import mesh checkbox make sure skeleton has nothing selected because we are currently importing the skeleton we don't want to use any existing skeleton in our scene and into the advanced section check import morph targets it's really important in order to import the two morph targets for the top and the bottom part of the suspension click import and this will import the skeletal mesh the skeleton and it will create a physics asset let's start with the skeletal mesh and into the asset details let's choose the proper materials from the kid bash 3D kit now it works as it was we before we exported it let's click save and we can delete all this additional materials here now we have a landing gear working imported into the scene and let's start creating the logic that will drive the top and the bottom suspension parts the way I'll show how to do this will be with the animation blueprint let's create an animation warprint and choose the skeleton acid that we created so this will be landing gear tutorial skeleton and hit create let's call it animation blueprint tutorial of course choose a better name for yours more descriptive for the actual function and in this warprint we'll create the logic that will drive based on the rotation of our bones the movement of the top and the bottom suspension let's go into the skeleton mesh and actually this is the skeleton mesh and inside choose the post process animation will print and here you can select the blueprint that we created now let's click save and this will ensure that this logic in our blueprint is applied to our skeleton mesh after any other animation from the other animation we'll get an pulse which will here use as an input pulse and this input pulse will modify into our final output pulse that will control our suspension parts the top and the bottom let's start with the top one create a bone driven controller and for the source bomb let's start with the top bone it will Drive our morph Target [Music] The Source component will be our rotation let's choose the rotation X for now but probably will need to check it and make sure that we are using the proper axis and now we need the name of the morph Target that we will be driving let's open back our skeletal mesh inside you can see the two morph targets that we imported for the top suspension we'll need this one so copy the name and here paste the name of the morph Target that you want to drive with the source top bone we need to remap the values because the rotation will be from 0 to 30 degrees and the actual value for the morph Target will be from 0 to 1. you can see that at zero it's extend it all the way and that one it's compressed all the way that's why we need to remap The Source value from 0 to 30 and will output from the range from 0 to 1 Let's compile and save we need to connect the input balls to the Bone driven controller and then the bone driven controller to the output pause compile and save again now when we move our top bone it will control our top suspension I have it connected to the wrong axis it should be to the blue one as you can see here from the course this is the z-axis so let's choose rotation Z compile and Save and now when we rotate from 0 to 30 it is properly increasing our top compressed morph Target from 0 to 1. let's do the same for the bottom one copy this foreign to the other one and now let's change the bone that we're using to control the movement to the bottom bone here the parameter name to the other Target [Music] and let's check now the rotation will be again the Z axis rotation Z it will be again from 0 to 30. let's compile and save and test it it's working fine when it's at zero we have it fully extended and when we go to 30 it's fully compressed it seems to work fine and now what we'll do is we'll create one variable that will control the rotation of our bones and then this root this bone rotations will control our morph Target with the setup that we already created so let's make a transform modify bone component here the bone to modify will be the top one for the first one will change the rotation so in the rotation section choose the rotation mode add to existing if we have any rotation we'll add it to the current one and then we'll split the PIN for the rotation because we only want to rotate the Z value and will promote this to a variable let's call it [Music] bone rotation and will have the same one copy and paste the same note connect it to the other ones and change to the bottom bone everything else will be the same connects our rotation to the rotation Z and now when we compile and save if we change our value for this bone rotation to 30. actually we have it connected to the wrong values for the rotation let's change that now our bottom bone is fine but our top bone is rotated the opposite Direction so we need to multiply this by minus one now compile and Save now it's working as we want it let's say a value of 15 will be in the middle of the way from fully extended to fully closed zero for every value we have our rotation of our top and bottom bones controlled by this single value and our compression for the top and the bottom suspensions are driven by this rotation value as well this everything for our animation blueprint and it's already connected as a post process animation blueprint to our landing gear so it will work every time that we do an animation on our landing gear it doesn't matter if it's imported animation or will control it with some other value we'll have this blueprint adjust our morph targets accordingly in the next step is to start with the character blueprint I assume that the viewer that requested this tutorial has some character setup so I created this simple spaceship it's just a box that will put the landing gears on you can see here is the Box Collision component inside we have a spring arm and just this box mesh to represents the spaceship you can swap it for any better mesh later and we have a floating Pawn movement component in order to have the movements of our spaceship setup start with importing the landing gears here drag the skeleton mesh inside the viewport and move it in place [Music] copy and paste for the second one and then copy and paste both of them [Music] and rotate now I have them all placed let's start with the blueprint code let's start creating the variables so click the plus icon and start with the variable is landed it will be a Boolean type then we'll need an array for our our landing gears create one variable called landing gears it will be other type skeletal mesh components object reference and the type will be array the next variable will be Landing distances [Music] it will be a type fault and it will be array again and the final one will be landing angle curve it will be our type curve fault curve volt and to be a single type for our Landing distances array we'll create four elements for the default value and put each at 30. because when we are landed like you can see here in the viewport all of our landing gears should rotate to 30. in our animation because this was the angle that we must use to have the full animation for our landing gear let's populate the landing gear skeletal mesh component array as well we'll do that in the construction script so whatever you do for your character in the construction script in the end just Ctrl drag the landing gears array here then use an ADD and start adding your landing gears to this array we will need four elements into the same array and we'll put all the four landing gears here now we have an array with our landing gears and array with the landing distances both with four elements and power is landed Boolean should have a default value of true now let's go to the event graph and start setup the process for takeoff so start with keyboard event let's say we'll do the pressing of the Z key and what we want to do when we press the Z key is to start an animation that will start from zero and then it will go to The Landing distance for each of our landing gears to start this animation let's add a timeline it will be take off animation double click to go in will have the length of two seconds for this animation and we'll add a float track this wall track will call animation multiplier or distance multiplier will add a keyframe the first one will be at zero zero we'll add another keyframe and it will be on our max length this will be 2 and the value will be 1. so we have 2 seconds animation that goes from 0 to 1. compile and Save and go back to the event graph for this animation what we want to do is for each landing gear start the animation and animate to our Landing distance in the array for the corresponding landing gear Ctrl drag the landing gears here and [Music] use a for each whoop that way we'll have the same code executed for the O for landing gears that we have in this array for each of our landing gears what we want to do is get the post process instance this is our post process blueprint and we want to set inside the bone rotation variant so first we need to cast it tool the animation blueprint class that we made animation warprint tutorial and then we want to set the bone rotation variable and the value for the bone rotation will be calculated by multiplying this multiplier from our timeline with the value of our Landing distance array for the respective landing gear index so drag this Landing distances array get a reference and the index will be the one that we are executing on our for Loop for each landing gear get the proper distance and then multiply with this multiplier from our animation timeline here and set this to the Bone rotation that way when we start the animation we'll start from zero and at the end we'll multiply 1 by 30 the end will be 30 so we'll animate from 0 to 30. our landing gears when we press the Z key Let's test if it's working hit play and now press the Z key you'll see that each of our landing gears is animating from 0 to 30 if I press the Z key again nothing happens play from start each time in that way every time that we want to animate it again the timeline will start the game from zero but we want to check if we have our spaceship landed because now if I change that to play from start and if I press that after the animation ends if I press that again it will start from the beginning I will add a branch note to check that if we are landed hold the b key click anywhere and this will create a branch node and I will check if we are landed this is the condition that we want to satisfy in order to play our animation and when we finish our animation we want to set our is landed variable so I'll drag it here into the event graph and on the finished state of our animation will set the is landed variable to false we can create the landing animation the same way that we have the one for the takeoff I'll copy everything just do [Music] it a little easier so we'll make another keyboard event for the X key let's say when we press the X key we'll check if we are landed for the landing animation we don't want to be landed so we'll disconnect the True Value and we'll connect the false value and because our timeline is set up to play from zero to one for the landing wheel actually want to play reverse from the end so it will start from 1 and will animate to zero and after we are finished we want to set our is landed variable to true now if I compile and Save D5 play when I press them that key to animate from the ends and all my landing gears will compress and if I press the X key the animation will play in reverse and will land if I play the takeoff animation and then move somewhere that I shouldn't be able to land and I press the X key our Landing animation is played and now we are we have the state set as if we have landed and I cannot control my spaceship anymore we need to fix that let's open again our event graph and we want our Landing animation to check if we can actually land are we close enough to the ground so we can land our spaceship the way we check that is with the wine Trace so after the check if we are landed if we are not landed so we are flying we need another check what we will do is do a wine Trace by Channel we'll create a branch node here and we'll connect this return value here to the branch so this return value will hit true if we successfully found the hit for our line Trace between the two points that we set here [Music] for the start and end point we'll check for each landing gear if we are close enough to the surface so we can land let's start with doing it just for one of them just to explain how it works and you then know how to do it for all of them just in a four Loops so I'll drag this one just to show you how it works and we'll change to the forward later so we'll get the world location for our landing gear and this world location for each landing gear is the point that you have marked here with the movement control so it it's on the bottom of each of the landing gears it's your pivot point for the blending gear skeletal mesh so this is the end position that we want to trace so we'll start somewhere here at the top and we'll Trace down to check if we have our ground underneath the spaceship so in the event graph this will be our end position and we can subtract a little from our Vector so we can give a five centimeters Gap below our landing gear it will be easier to land our ship and for the starting point we'll add a vector we'll have it starts two meters away from the land point and let's for now choose the draw debug type tool for duration so we can see our line Trace shown in the viewport hit the Z key to take off and now when I hit the X key I have a line trace for one of my landing gears with this red line and it's hitting the ground and because it's hitting the ground we play all the animations if I go higher and I press the X key you can see that the line Trace doesn't hit anything is just the line it's not creating the dot for the hit if I go down [Music] and I press X a little bit more down now that we have the this dot for the hit the check for the successful hit is giving true and that's why we are playing the animation we want to do that for all four of our landing gears and we want to play the animation for the landing just in the case that all four of our landing gears are in close enough distance to the ground so we can land so control drag our landing gears hooray on here again and do a 4-H Loop and for each of our landing gears we'll get the world location we'll do a line Trace if we have a successful line Trace what we'll do is we'll save the distance from our line Trace into our Landing distances array so Ctrl drag our Landing distances array and then hit add if we have successfully hit the ground with power align Trace let's split this pin and we'll save the heat distance into our landing gears array because the heat distance will be bigger than 30 and we want in our array to save values between 0 and 30 for now let's do it that way delete this value by 200. because the distance from the start to the end of this wine Trace will be 200 because we are starting the line Trace 200 units away from the place that our landing gear shoots lands successfully let's save it like this into our Landing distances array and because we are adding here components we need to First clear our array so Ctrl Drag The Landing distance right here hit clear now each time we try to blend with the X key if we are not landed actually let's first check if we are landed and then clear the array so if we are not landed we clear our Landing distances array then we populate the array with the new hit values from our line Trace and then when we complete this check for all of our landing gears on the completed event of our for each Loop let's check if now our Landing distances array has four elements so get the length of this array check if it's equal to 4 so we have a hit for all four landing gears connected here and only if we have our four elements then we can do the animation that we created earlier and if we don't have our Landing distances for all the four elements then we will not play this animation will instead will make a for Loop we'll do it zero to three so it will execute four times for from zero to three and we'll add the landing distances 30 for each of them like we have our default values because we clear the array each time that we try to land our spaceship if we don't successfully find Four Points to for the each landing gear we want just to return back the default values so we'll add an element of 30. four times if we don't have successfully find the four line traces for each of our landing gears we'll compile and Save and now if I hit the Z key to take off if I hit the X key we have landed but we don't have our animation playing let's check we have some kind of a problem with our Landing distance probably we don't want deleted by 200 want us to multiply by 30. because if I delete my Landing distance of 200 by 200 it will return one and we need 30. this is just an example I'll change that now to a curve but I wanted to show you why we are doing this now if I hit that the animation will play for the takeoff and if I hit X you'll see that our four landing gears have this successful hit wine trace for each of them that's why we are landing if I hit that key to take off and then if I move here and I go a little bit higher [Music] if I hit that key the X key I have only one hit for the landing gear in the top in the front left and no hits for the others that's why we are not playing The Landing animation and we are still flying with our spaceship we can only land if our four landing gears are having successful hit point so let's go a little bit lower and hit the X key a little bit lower again hit the X key because we have the four successful hits for our landing gears we played our animation but the animation is not taking into account what's the distance between our landing gear and the ground that we have we always play the full animation you can see that too if we play the takeoff animation we just go lower and hit the landing animation button our landing gears are digging into the ground to change that we want to change our takeoff and Landing animations to have calculation how far we need to go here we save our distance into the landing distances array and the landing distances array should be used here properly to set our bone rotation what we need to do subtract will subtract from 30 our blending distance value multiplied by power Landing distance multiplier timeline and then we'll add this value and this is the value that we'll set for the bond rotation we have some incorrect calculations here so we need to subtract this value and then we need to add the value multiplied by this animation now let's check take off with the Z key [Music] somewhere that we have different distances for of our landing gears then hit the X key and you can see we have different animations for our landing gears but it's not actually properly rotating them and that's because we don't have a linear difference for the Lego that we want to use let's use the skeletal mesh for example [Music] when we have our rotation at 30 30 we have the minimum distance that we can extend our landing gear and at 0 0 we have the maximum extended position for our landing gear but in 15 we are not at the middle of this distance the distance value is not directly changing with the same rate as the angles that we want to rotate our landing gears to and that's why we created this curve variable earlier let's go back into our spaceship we have this Landing angle curve here right click into our content browser in the miscellaneous section choose a curve and we want to create a curve fault let's call it Landing angle tutorial [Music] now move it to the tutorial folder and inside this curve we want mapping for our distance between 0 and 200 and what our angle should be depending on the distance that we have I already have the curve created before here so I'll show how it should look like for the zero zero value we have a keyframe and for the 200. value we have a value of 30. and between them we are not linearly changing so it's not just a flat line if we have our value at 100 it will not be 15. it will be somewhere around seven and a half degrees of rotation let me show you how to do that just add a key here put it at 0 0 add another key put it at 230 and now for both keyframes choose the type as cubic interpolation and rotate them in the way that for the value of 100 so this line here is the 90 so the next one is 100 and the value should go a little bit under 7.5 degrees for the 100 let's click save now let's go back to our spaceship now go here instead of saving this value here that we calculate with these two notes I'll delete this in this curve variable we'll put the Landing angle tutorial curve that we created now we'll get the fold value and for the in time we use our heat distance this will be a number between 0 and 200. and it will map the value to this uh other variable that we have set up from 0 to 30 and we'll set it in our Landing distances array for each of the landing gears now if we take off with the Z key and we go a little bit lower and hit the X key to land it's calculating properly the distance and the angle for each of the landing gears I'll hit that again and for the takeoff animation we started from the beginning we need to change that now we only fix the landing animation our takeoff animation here is not set up with our proper animation values so will subtract our value 30 and then we'll add this value to the one that we calculate from our animation so subtract the landing distance is value that we save and then add it to the one that we are applying the animation it's the same formula like we have for the landing here we have a mistake it should not be multiplied we should use an unknown instead let's hit play press the Z key to take off now press the X key to land let's check from lower distance press X to land press Z to take off now let's move somewhere that we have different values for each of the landing gears press X now press Z to take off now we have all our four landing gears animating properly extending just the distance that they need and animating for the landing and the takeoff animation with the proper distance setup this is the setup that I have in the beginning of the tutorial hope that this helps the viewer that requested this tutorial and it will help you to use any morph Target animations in your characters it doesn't really only need to be for this type of animations morph targets are often used for facial animations and for other organic characters it's really beneficial to know how to use the morph targets animation and this way with the post process blueprint is the easiest way I believe that you can use to apply these animations to your blueprints so that's everything for today please like And subscribe and you can write for any requests for other tutorials and I'll see you next time [Music]
Info
Channel: DK 3D
Views: 656
Rating: undefined out of 5
Keywords:
Id: HOm9QH_Voic
Channel Id: undefined
Length: 74min 43sec (4483 seconds)
Published: Fri Jan 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.