How to make first person weapon animations for Unreal Engine 4 (using Blender and MrMannequin v1.2)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody what's up welcome back to a new unreal engine 4 video in this video i'm going to show you how you can make custom animations for the default epic skeleton so for this we are going to use unreal engine 4 obviously and we need blender and also a blender add-on called mr mannequin tools now let's start in unreal engine 4 so this is just the first person shooter template and i added a little assault weapons pack i'm going to use to show something at the end of the video don't worry about that you can just start the first person example template and that should be good now we're going to add weapons to this so let's go to the epic marketplace and i added the military weapons pack i'm pretty sure that's a free pack but i can't see it anymore because i already have it in my collection so just search for the military weapons and you should be able to find it let's add it to the project it will say it can't edit because it's another version so show all projects and we're going to select our project and from the drop down list here select the highest version available and then simply add it to the project and that's good to go so we have the weapons in here let's export one of the weapons as an fbx so we can use it in blender later on i'm gonna use the pistol so simply right click it and go to asset actions and then export so let's save this somewhere let's see oh i already exported it from a previous attempt of recording this video but so just export the fbx click save and you should be prompted with this window you don't need to change anything just keep the default settings and click export and we have the weapon exported so next we need blender if you don't have it just download download it for free so search for download blender and just download the installer and get it going if you open it up it should look something like this so a really quick blender basic tutorial um if you use the middle mouse button you can rotate the camera if you hold shift with the middle mouse button you can pan the camera the left mouse button is to select stuff and the right mouse button brings up the context menu so that's the super basic default controls okay so that's blender for now and we need the add-on i told you about the mr mannequin tools add-on it's made by jim kruvi and it's a pretty cool add-on you can use to make animations for the default skeleton so just search for the mr mannequin tools for blender and it's available on a few sites you can make a donation to the creator if you like to or you can get it for free whatever you prefer so just enter the amount you want to donate here if you don't just enter zero and then purchase it so i'll put a link to the channel and the home page from jim groovy into the description of this video as well so you can check it out he's a pretty cool guy that knows a lot about animations and blender and stuff and you should be able to learn a lot of things from him so make sure you get the add-on now you'll be prompted to save the zip file just save it somewhere mr mannequin tools.zip and leave it as it is now we're going to go back to blender and we're going to go to edit preferences over here select the add-ons and on the top right here you can click the install button so just navigate to the folder where you saved it and we are going to install it so that's blender plugins highlight the zip folder over here and click install add-on so i'm not gonna do it i already installed it but just click it and it will install the add-on for you you can check it in the list over here characters mr mannequin tools should be available and it should be checked so it's active so we have mr mannequin tools installed and we have blender ready to go now we need to save this file because otherwise we can't do anything with it so just save the empty file and just put it somewhere it doesn't matter we're going to delete all the stuff that's already in here so just select everything press delete and it's gone now on the right in the viewport here you can see a little arrow you can drag it out to the left and you see a new menu appear there's the mr mannequin tools tab and we are going to select this and we're going to load the rig so at the bottom here select the correct rig we want the mannequin skeleton click that one and load the rig there it goes now with this rig in place select this and you'll see the menu over here change we can add a mesh to it so at the bottom here we want to select the mannequin lod0 mesh and we're going to click load mesh and there we have our mannequin so this is what we are going to work with but we need something that represents the first person arms in ue4 i guess because if we want to make animations and we place the camera here we can't see anything and it's going to be annoying so let's get rid of all the excess stuff we don't need i'm pretty sure you can also import the view arms from unreal engine or custom meshes but i'm not really sure how that works yet so we're just gonna work our way around it it's a little bit tedious but if you just save the file once you're done you only need to do it once in a lifetime so it's not that bad first of all we're going to select the control rig over here and select the little green running guy on the right so select one of these empty squares over here and the controls disappear so it's a bit easier to work with now we're going to select the mesh and on the top left over here from object mode we're going to change it into edit mode three little square buttons appear right to the edit mode button and you want to select the last one of the it's the face selection so we can select the faces of the mannequin now so there's one little button on the top right here that's useful at this point and that's the x-ray button so if we are going to select faces right now and we look at the back it doesn't select the faces on the backside it will only select whatever you see so if you activate the x-ray and drag select it will select everything so that will make your life a little bit easier i will enable the x-ray button and we are going to delete the entire body so select it press delete and then click faces it's going to delete all the faces now on the top here you want to be a little bit more careful because on the inside there's some like shoulder cones i guess you want to keep those so be a little bit careful with removing these spaces just delete all the stuff you don't need so on the inside here are these little spheres i told you about so you want to keep this part because that's part of the actual arm and you just want to delete everything around it so as i mentioned it's a little bit tedious but just make sure once you're done you save it and keep it in a safe place so you only need to do it once in a lifetime and you're good so if you did that properly it should look something like this where you only have the arms left and it's just like the mannequin model first person in unreal engine 4. so the next thing we want to do is go back to object mode and we want to make sure we reveal our control rig again so we are going to click the mannequin in the collection over here and to reveal the bones we actually need this time we're going to click this little circle on the top left and you see the actual bones of the skeleton we're going to add like sockets for the camera and for the weapons in the hands so we can make sure the placement in unreal engine is exactly the same as in blender so select one of these bones randomly and it will select the entire skeleton then we need to go to the edit mode on the top left again and you see the bones change now let's start with the camera bone we're going to add so select this top bone over here if you look at the top left it's going to say it's the head bone that's the bone we need so make sure you have the head bone selected and then on the top on the left sorry at the bottom here you're gonna click the extrude button which will make us create a new bone so extrude click the little plus sign and just drag it out it doesn't really matter how big you make the bone just something like this will do and go back to the selection mode now we're going to select our newly created bone and in the collection over here right click go to view show active and this will reveal the bone we just created so it named it head001 we are going to rename it so double click it and i'm going to call it the camera socket that you do it and now we need to move it into position but it's still parented to the other bone so select the new camera socket bone right click go to parent and select clear then select disconnect bone now the bone is disconnected and we can move it around so i'm going to place it a little bit below the head bone something like this it yeah it does matter but you can change it later on it's you need to figure out what's the perfect position how you want it to look you want it a little bit more further away closer to the hands whatever so it's not set in stone you just need to mess around with it so we have a bone added for our camera that's pretty sweet we're going to do the same thing for the weapon sockets in the hands so let's go to the right hand first you see these huge bones and they are in the way so just select them and press the h on your keyboard the bones will be hidden and it's going to reveal the hand bone select this bone and make sure you have the hand right selected again we're going to extrude a new bone so click the extrude button on the left here and just drag the little plus sign you create a new bone again select the newly created bone and find it in the collection so view show active it should be in the center here so it's the handwrit001 we're gonna rename it to the weapon socket right just like this again we need to disconnect it so select it right click go to parent and clear disconnect the bone and now we're going to move it into the palm of the hand so select the move tool over here to the left i'm gonna set it to the normal transform orientation and i'm gonna move it around so i do want to turn this 180 degrees so it's pointing in the right direction and then i'm gonna roughly place it into the palm of the hand so again it doesn't really matter where you place it exactly in the animation later on we can change it so as long as it's in the palm of the hand somewhere that should be fine now if you hold alt and press h again it will reveal the bones we previously we previously hidden and we are going to do the same thing on the left hand so select the two big bones over here press h and they will be hidden it will reveal the hand left bone like this make sure you have hand left selected we're gonna extrude a new bone and we're gonna drag the little plus sign out to create the bone go to the selection tool and let's rename this so u show active and there we have our new bone hand left 0 0 1 and it's going to be weapon socket left we need to make sure it's not parented anymore so parent clear disconnect bone and we're gonna move it into the palm of the hand again as long as it's roughly in the correct position that should be fine so there we go now press alt and h again to unhide the bones and we have a few bones added to the skeleton we are going to use later so let's go back to the object mode on the top left here and now we want to reveal the control rig again so make sure you have the little green running guide selected and then while holding shift press these little four squares over here and we have the control rig back up so at this point you might want to save it as a different file because you added some bones and you can keep the original arms in a separate file so you can always go back if you want to do something else so let's save this i'm gonna just name it first person arms that's fine and we are going to export this to unreal engine so we are going to select this mesh first then hold shift and select the control rig now on the right here you can select the export message and then you can select the folder where you want to export it to so just pick a folder where you want to put it in you cannot actually name the file it will automatically name it so just select the folder and that's good we're going to click export fbx and it should be done in a few seconds so let's see we have our exported skeleton over here so let's go back to unreal engine and we're going to see if it worked i'm going to create a new folder over here there we go and just drag it in now you're prompted with this window you don't really need to change anything i'm gonna say it's not going to import materials or textures because they're already here so we don't need them import this and there we have our newly created skeleton so if i open this up you can see we now have a weapon socket left we have a weapon socket right and we also have a camera socket so we are going to use those later on awesome that's working so far now the next thing we need to do is go back to blender and make sure we have the gun in our hands so we exported the gun already at the beginning of this video so let's just go back to blender and we're going to go to the file import and we're going to import an fbx file so let's select the pistol we exported from unreal engine and click import fbx and there we have the gun now we need to attach this to the skeleton and to the weapon bone or the weapon socket we added so we're going to do that with a constraint over here in the collection we're going to select the pistol and then on the right of the viewport here the third button from below it's going to add an object constraint so click this button add object constraint and we want to make a copy transform constraint so select this one now for the target you need to select the skeleton so the ue4 mannequin skeleton look for it in the list it's there the ue4 mannequin skeleton and once you've selected it you can select the bone you want to attach it to in our case that's the weapon socket what's happening yes so we want to attach it to weapon socket right now there's a huge gun that's not probably or properly orientated and we're going to fix this on the mix setting here instead of replace we're going to select before original and the gun is now in the correct position and it's the correct skill all we need to do is rotate it properly but we can do that by animating the bone so if we use another gun for another set of animations we can simply move the bone around to fix that issue so this is all we need to do here let's see let's go back to oh we're already in object mode okay that's good then we are going to select the skeleton over here and we're going to go to the pose mode oh blender didn't like that so let's so something crashed over there but we're good again so let me see where was i we're going to go to the post mode to properly place the gun in the hand so let me see select the little circle over here and it's going to reveal the bones again select the skeleton and we are going to go to the pose mode zoom in on the hand and select our weapon socket right and we're going to orientate it a little bit better so the gun is roughly in the right position so you want to rotate the socket we created and not the gun because the gun is parented to the socket so it should automatically follow so we can move it around rotate it place it wherever we like it so let's go with something like this for now now with this bone selected you're going to press the i button on your keyboard and you're going to select location rotation this is going to keyframe the bone so it stays in this position so if you did that a little dot appears over here on the timeline indicating that this bone has a keyframe on this frame so that should be good let's go back to the object mode and let's review our control rig again so with the little green guy selected over here select these four squares while holding shift and we have the control rig back now to animate this we are going to select the control rig and go back to the post mode and we can manipulate all bones with all sorts of controls over here so for example with this little hand controller i can control the hand and the bone we created is attached to the hand and the gun is attached to the bone so everything will follow so if i just move this around you'll see everything moves with it and we're going to place it roughly into the right position something like this now as you can see the elbow is popping in you can control them with these little circles throw over here so if you select the thingy and move it back out it'll push the elbow back out so there's all kinds of controls or all body parts and you have to mess around with them and how everything works so that's really how animation works there's plenty of tutorials about that and that's not what this video is about it's going to take long enough just to show this so i can't go into the depth of the animation stuff but there should be plenty of tutorials around for that somewhere so we going to place the gun somewhere that we think is going to look pretty okay and we can change this later so it's just like the first setup so let's do something like this now i'm going to press a on the keyboard that's going to select everything and then i'm going to press i again to create a location rotation keyframe so now everything is keyframed and we want to export this to see how it looks in unreal engine but if we want to export it we actually need to have some parts moving otherwise it's going to complain it's not an animation so press a again to select everything i'm going to copy this keyframe over here right click and press copy just move it to frame 30 and right click paste it now i'm going to move back to frame 15 and i'm going to select just the left hand over here and i'm just going to move it inwards like this then press i and place a location rotation keyframe again so now if we move the timeline you can see the hand is moving so this is not something we can see in game but it allows us to export the animation so we can see the positioning of the gun and the camera and stuff like that so this is our first animation so let me see let's save this and then we're going to go to the animation tab over here you want to go to the action editor and over here you can enter the name that your animation is going to end up with when you export it i'm going to name it fb man pistol idle oh i had caps lock on that's nice fp man pistol idle so that's just to name it now let's go back to the layout tab over here and we're going to export it so select our control rig over here deselect export message we're going to export animations again we can select the folder where we want to export it so let's export it over here i'm gonna click this little start and keyframes because sometimes the first and last keyframe disappears so you need to mess around with it i'm just going to click it to make sure it works this time and then simply click the export fbx over here it will export the animation for us it's over here so this is the name of the skeleton this is the name we put in the animation tab and this is the animation now let's drag it into unreal engine it should automatically select the skeleton we previously added so make sure it's importing it on the right skeleton and then you can simply click import no need to change any settings and there we have our animation so at this point we want to add a camera and a gun and see how things look in game i guess so what we're gonna do next is going to create the character i'm just gonna copy the first person character that came with this example template let me see where is it copy it that's fine so open this up in the viewport we don't need all of this virtual reality stuff so just delete this i'm gonna delete everything except for the inherited components and let's add our own stuff so select the mesh add component skeletal mesh and this is going to be the character mesh we created so add this one now let's move it into position and turn it 90 degrees probably move it back a little bit so i guess that should work for now something like this then select the skeletal mesh and add a new component again and that's going to be our camera now select the camera and we're gonna parent it to the camera socket we created so over here parent socket you're gonna click the little search icon and we're gonna search for the camera socket you'll see it pop into position now all we have to do is rotate it just like this so now our camera is attached to our camera socket and we know it's always in the same position and we're going to do the same with the gun so again select the skeletal mesh add a component and add a new skeletal mesh so this is the weapon mesh so that's going to be our pistol we exported earlier over here and then simply for the parent socket we can select our weapon socket right and it'll pop into position now if we make this mesh play the animation we have so select the mesh and on the right here instead of use animation blueprint we're going to say use animation asset and we're going to select the animation we imported and there we have it so this is our basic character let's compile and save this now we're going to end up with all of this crap because this was the basic character and i deleted a bunch of this stuff here so let's go to the construction script delete this attach to component node and in the event graph we want to delete all of the stuff down here spawn projectile we don't need it we want to plug in the mesh over here and again this is for some virtual reality stuff we don't need it and now we should be good to go the errors are gone so that's good now let's rename this and go to the world settings of our project in the game mode override we're gonna simply change the default pawn to our newly created character my fp man and now in the viewport you want to delete the default character so just select it and delete it and now if we press play we are dropped into the map with our own custom character so this is what it looks like so as you can see we probably want to move the camera down a little bit or we want to move the hands forward a little bit or probably both so let's just do that first let's go back to blender over here and what we are going to do select the control rig and go back to the pose mode now make sure you are in the first frame and select the hand over here now first thing i'm going to do is move the hand forward a bit more and move it up a little now if you are going to drag the timeline you're gonna see this will pop back into position so if you look at the hand while i drag the timeline you can see it moves back into the old position so you always need to keyframe everything when you make animations so i was going to move it forward and up a bit and then press i on the keyboard to place a location rotation keyframe again and now you see it stays in position although the last keyframe we didn't change that so it's going to move in between those that's not what we want so make sure we copy this keyframe to the end as well so right click copy let's go to frame 30 and paste it so there we have our new idle position what you could also do is change the tag camera a little bit so if we want to do that we have our skeleton selected over here and we're going to reveal the skeleton bones by pressing this circle then we need to go to the pose mode and if we select our camera socket over here and make sure we are in the correct frame our camera socket is not keyframed because it always is in the same position so that's not too bad so we can move it down a little bit for example and maybe move it forward and i think we're good so that's how you can adjust the camera position as well so we changed it a little bit now let's just for fun funzies also change up the fingers a little bit to show you how it works so if we are going back to the object mode and reveal our control rig again by selecting these four squares we can animate the hands and fingers and all that stuff so let me make this a little bit clearer to see by just selecting one layer you can choose which controls you want to show if things get a little a bit more hectic on the screen so so for example if i select the pose mode now i can move the fingers around by simply selecting this controller and if i rotate it you'll see the finger move so just like that you need to change everything and that's how you make animations now this is tedious work and the longer you put into it the better it looks in the end i guess though making animations is really not hard but you're going to need patience for it lots of patience especially when you're new to it you're going to have to learn a lot so let's move these fingers quickly it doesn't really matter i don't have the time in this video to actually make this look good so as long as we can see something changed that's fine okay so we have a sort of a idle pose right now now before you click anything else make sure you keyframe this otherwise you can start over so press a to select everything and i'm gonna keyframe it i location rotation and i'm just gonna copy all this crap so right click copy go to the last keyframe and paste it now you see the finger spread out again because this keyframe isn't keyed so that's how animations work but i don't want to animate this so i'm going to paste it so there we have it now we don't need all of these keyframes let's rubbish there we go so let's see if this looks any better in unreal engine and that's actually pretty easy go back to the object mode and select the control rig so again export animation start and keyframe just export it now it will override this file so if we go back to unreal engine now and we are just right clicking on the animation here and click re-import it will re-import it automatically and it will change so we can simply press play and check how it looks now so you see we can actually see more of the hand now and the camera is in a little bit different position so that's how you want to change stuff like that so i guess we have sort of an idle pose now to work with so let's go back to blender over here now how do we actually make an animation well let's see we are going to make a race and a lower animation and we are going to go to the animation tab first here make sure you're in the action editor and drop down there's only one animation in here right now and we're going to add another one so if we press this center box button in here it says new action click it and now you see there's two of them and it automatically named this one so select this one and rename it to whatever you like i'm gonna call it pistol lower now we are working in this animation so if we go back to the layout over here and select the control rig in post mode you'll see keyframes over here but they're grayed out so they are not active in this animation at least they shouldn't be what's this oh it's because it duplicated it so we can simply delete it so if we select everything here press a on the keyboard and just delete all the keyframes now this animation is empty and if we go back to the animation tab and we select the pistol idle go back to the layout then the other animation is still there so you can work on multiple animations that way so make sure you have the pistol lower selected go back over here now the first frame i'm always going to keyframe everything so first make sure we are in post mode press a on the keyboard press i and make a location rotation keyframe now this lower animation is going to be pretty short let's make it 20 frames and this is going to be a super easy animation so i'm just gonna select this right hand over here i'm gonna move it out of the screen backwards a little and let's rotate it down something like this so again press i location rotation keyframe and there we have our lower animation i know it's a real lame animation but in the end it's still an animation so if we go back to the animation tab right now and again we are going to create a new action and we're going to call this pistol race press a to select everything and now it's even more easy than it was already because we can simply drag these keyframes around so i'm going to place the last keyframe on frame 1 and the first keyframe on frame 20 and now our animation is mirrored so we have a race animation easy as that now let's go back to the animation tab one more time and create one new animation and i'm gonna call this pistol fire go back to the layout tab again and select everything so press a on the keyboard i'm going to remove this first keyframe entirely now this is the base idle position so let's move it back into the first frame now this fire animation is going to be even shorter let's make it how about four frames or something so i want this to be back in the idle position at the end of the animation so again i'm going to keyframe this at the last frame so press i location rotation and then at the second frame i'm going to move the hand so go into pose mode and now we want to rotate it a little bit like this and move it back a little press i on your keyboard location rotation keyframe and it messed up my last keyframe somehow but that's not really an issue so just select the hand go to the first keyframe no don't paste it ctrl z okay go to the hand select the first keyframe and copy it instead of paste it then select the last keyframe and paste it with the dilio there it goes so we have a fire animation now you can also animate the gun but you have to do that separately so for example if you want to make an animation where the slide and the hammer moves you'll have to go to the animation tab again you're going to create a new action and you'll want to animate the weapon itself so if i go into pose mode i can also move these bones around and you can make animations for the weapon just like that so if you simply play an animation on the weapon and on the arms simultaneously in unreal engine that's how you make both the hands and the gun animate at the same time so for now we are going to do with the idle fire and raise lower animations we made so i'm going to go back into the object mode select our control rig over here export animations and i want to batch export them so they're going to be exported all of them and simply press export now if we open our folder all of the animations are here so we have the idle but that was already here and we also have the fire lower and race animation we can simply drag them into unreal engine make sure they're imported on the right skeleton and just import them and now you can see we have a fire animation we have a lower animation and we have a race animation so that's basically how animating works and how making animations with the mannequin tools works now the animations themselves you can make them extensively complicated or really simple so that's just how much time you want to spend i guess there's really a lot of tutorials about animating and i'm not a huge expert on it i hardly know what an ik or an fk chain is so you're probably off looking at other tutorials to actually learn animating however this is the basics to get you going and to actually get the animations into unreal engine so i hope that helped out a little so if you are using a skeleton that is scaled to the epic skeleton you can pretty easily retarget these animations and use them as well so for example let me show you how that would work so if i open the skeleton i need to go to the retarget manager and i need to make sure this is set to the humanoid rig over here and then i need to save it so i have another set of few arms over here and they are also wrecked to the epic skeleton and they are scaled properly so if i open this skeleton and i also select the humanoid rig over here in the retarget manager and again i save this i can close this down and if i go to the animations we created and for example i pick my pistol raise animation i right click this and then retarget atom acid duplicate animate and retarget so i can select the new skeleton i want to retarget it to press retarget over here what the need to have a preview mesh oh really okay so apparently i need to have a preview miss setup so over here click apply to asset to apply the preview mesh i don't know why but that's important apparently i think this one already has it yep so if i retarget this animation now and select the other arms press retarget will copy the animation and retarget it to the other arms so i can use it for other skeletons as well as long as they are skilled to the epic skeleton so that's that part now let me quickly show you how it could use if you how it could look if you spend a little more time making the animations i know this still doesn't look anywhere freaking awesome but it's better than what we had so i have a pistol with a lower and a raise animation there's my shoddy then we go to the assault rifle and a sniper rifle so you can see the hands are placed a little bit better and the animations are not great but they are a little bit better than what we created in the first video but it really it's all about patience and putting time in making the animations themselves but the way you create them i just showed you how to do it so i hope it helped you guys out and thanks for watching everybody later
Info
Channel: BluntStuffy
Views: 16,222
Rating: undefined out of 5
Keywords: unreal, engine, animations, first, person, fps, epic, skeleton, constraint, attach, rig
Id: 3-ksJ8U8ejk
Channel Id: undefined
Length: 47min 9sec (2829 seconds)
Published: Sun Nov 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.