Unreal Engine Beginner Tutorial Lesson 3 - Animation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys uh welcome to the Sean files um this is lesson three on um Unreal Engine uh for beginners and um I'm just gonna go over a tutorial with you guys on how to um do animation and Unreal Engine so um just to give you a brief of what I'm planning on doing with these lessons so I'm basically just going to give you everything that I've learned over the past four years in College learning game design and 3D animation I'm still learning there's a lot of things I still don't know that I still want to learn and I'm going to continue to learn and as I learn it I'll give it to you once I feel like I have a good grasp on it um as you can see in these tutorials I'm still trying to figure things out I you know things don't just come out perfect the first time you have to continue to kind of test and try to problem solve that's what a lot of game design is about is problem solving and uh logic and you know a lot of you your things aren't going to work right away not all the time sometimes they will but not all the time most of the time they won't and you just have to keep like like you know tinkering with it uh until it does work because eventually it will if you don't if you don't give up uh whatever you don't know you can always look it up online everything's online uh Unreal Engine is not really that great with their documentation and there's not really a lot of courses or tutorials out there for a neural engine a lot of it is uh figuring it out on your own and going into the community and asking questions from other people that have had more experience but that's why I'm putting this out there to help people out just like you know other people help me when I needed it uh when in my program we had to make projects you know not knowing anything and having to figure it out along the way and and I I feel like is the best way to do it because uh if you're actually trying to figure out how to make a game you're going to run into all of those roadblocks and learn the hard way and eventually you figure it out okay um let's go ahead and launch our project open up our scene so I believe there was something I forgot to tell you last time so just to recap on last lesson I was teaching you guys how to make things invisible visible how to destroy objects spawn objects and I wanted to say that I when we were destroying the objects we were first finding the location of where the object is before we destroy it then we destroy these particular these components and we put a delay on it uh for one second and then once uh for one time uh it will spawn an actor in the spot that it was was originally and I've when I told you guys to destroy these individual components I'm leaving the this actor still in the scene and I don't want to do that so after I spawn the actor then I want to destroy the whole actor so that way it's not we're getting rid of the trash you know what we don't want in the game and we're just leaving it to self because we wanted to destroy the whole thing so now I'm gonna run into it it's destroying the whole thing so then I'm not having like a bunch of like empty actors in the scene slow down my game I just want to show you that because I remembered it after the fact I'm sure that's gonna happen a lot so bear with me um on on that okay so today I wanted to talk to you guys about animation so I usually bring animations from Maya into unreal and with a rig already in place and then I hook up that rig and unreal and then I manipulate that rig in unreal or I just animate it in Maya and then bring it into unreal um the animations already made but you can also just bring the rig into unreal and then do the animations in unreal so I'm gonna go ahead and create a blueprint class actor and we'll name its um animation Factor one BP open that up all right I have to think of how we want to go about doing this okay so I opened Maya go to General uh go ahead and save your scene I know so just organized animation tutorial lesson one or three all right so in Maya click on the cube it will spawn a cube and click on this outliner window and do Control G that's going to create a group go ahead and rename the group by clicking on it double clicking and let's rename it let's name it uh animation object lesson three and uh put your Cube under it and we're also going to name the cube you can copy this and name the cube the same thing but then do like mesh at the end and at the end of this one you could do a group okay all right now copy not that okay go ahead and do Ctrl C on uh the object mesh and then paste it I actually don't do that sorry We're Not Gonna paste it in the outliner paste it in this what the hell all right let's go ahead and um restart y'all zero yep we're good so zero yeah so um you always want to freeze Transformations probably not necessarily right now but just to show you how to do that uh what it does is it zeros it out uh so whatever position it is in that will be it's default position so if you end up moving it you can always bring it back to where it was by zeroing it out over here if you freeze the transformation and that's reason transformation right there so I want to duplicate this guy so I'm going to do control d uh you don't copy and paste I don't know why I was doing that but you just do a control d and it will duplicate your object so remember control d and it duplicates your object when you're selected on it Ctrl d okay so we're doing two of them all right go ahead and save that okay um if you want to go ahead and UV map these guys so that looks like they're already remapped I mean you could see that uh squares are perfect but if you want to know how to UB map I'll show you real quick I went over here to UV editing this is just a really quick way to do it it's not the best practice way but it's a way to get it done fast I do automatic I copy it um unfolds um Orient shells that makes them straight and then layouts and that will lay them out perfectly on the um on the Square that it needs to be it only can be on one square you don't want to have it all over the place just here okay then um that's done this is a very very very very very uh fast way to doing it it's very lazy it's not the correct way of doing it I will show you another video of how to UV map correctly but for now this is just the fast way to get it done um so we can get on to what I'm trying to teach you which is animation so this basically allows the textures to lay out on it um where it's not the image is not stretched and you can control like how that texture is placed on the object with the UV map by the way you like cut it and sew it but we'll go over all that in another video um let's go to Breaking for some reason it put me into the perspective let's go to panel perspective and then go to perspective to get to be able to do this basically okay so we're gonna add in a couple joints and you do that by clicking on this guy right here disjoint guy you could also find it make sure I'm recording yep um you can also find it right here under skeleton create Joy so I click on or I don't click on it's already clicked but I click on the scene where I want my joints oh yeah it should place the join or why it wasn't working but place the joint into the seam by clicking on the scene then you're going to move the joint we want this joint to be exactly where this guy is so what we're going to do is we're going to click on the joint and the object that you want the joint to be at and you want it to be in the center of this guy so we're gonna go to modify go to match Transformations and then match all transformations sorry for some reason it didn't work because I didn't have object mode on how you do objects mode is you right click and then you drag over to object mode or you can find object mode up here this is object mode this is uh component mode basically where you can like uh deform faces and stuff uh like this but object mode selects the whole object um so you got to be an object mode to do this so I click on the joint then I click on the object then I go to modify and then match all transformations now if you go over here to this wireframe you could see right through it and now you see that the joint is right and uh the middle of this model now I want to duplicate The Joint so Ctrl D duplicates and then we want to do it again we have this joint 2 selected we're going to select the um Square as well I do that by clicking shift and then clicking the other object so that both objects are selected and then I'm going to go to modify and I'm going to go to match transformation all right so now uh these joints are perfectly centered with the square you're normally going to want to add in a control s are good for putting your model back into the default pose because joints they you don't want to zero out joints but you can zero them out by putting a control on them uh but you're wanting to animate the joints itself um Okay so we're gonna go ahead and name these guys this joint is going to go with a let's go ahead and um this guy actually is the second one this one is the first one so I'm gonna name that and I'm going to copy this and I'm going to add it in here to name it to have it to have the same name I add joint to to the second object this is parenting it so now this joint's parented under this mesh okay it actually should be the other way around where the mesh is parented Under The Joint but right now let's just do this because we're naming it all right let's go ahead and drag the joint over to the scene and let's parent these meshes under the joint you can also parent by going to constraint clicking on the thing you want to parents and then the thing they you want it to parents for instance if this was not so if I want to add a parent this I do shift p and then if I want this to parent this without this actually being under this in the hierarchy physically I would uh I believe I click on the parent first and then the object and then I go to parent and then now this has a constraint on it so now when I move the joint it moves the model um but if I want to just parent it this way I can do that as well where I have the model under the joint and when I move the joint it moves the model so you could do it either or the other way is a little bit more advanced and more professional best practice this way is a little bit faster and we don't really need to do advanced stuff right now I'm just showing you the basics so now we have our rig I can we want to actually connect these joints so I'm actually going to put joint to under joint one so now when I move joint one it moves the whole thing and when I move joint two it only moves joint two save that you want to constantly save and you're going to save it by doing Ctrl s you're gonna constantly say because Maya does tend to crash and you might lose your work you could also set it up and your preferences to have incremental saves which is always a good idea that way it automatically saves for you in case you forget you don't want to lose your work because you could lose a lot of time that way um let's go ahead and export our rig if if you want to animate it within here the way you do it go to animation click on the joint you want to animate and then um you're gonna go into this little guy and you're gonna press s to add a key so if I wanted to start in this position as a p and then maybe at the 13th second Mark I want the key to be over here and then so play it and that's what it looks like maybe I want the key to be like at this point I want it to be like right here and then right here this at the 32 second so actually I don't think these are seconds but um it's if you have it 30 frames per second then this is a second right here technically this is a second okay so then um over here so basically that's like the animation that you created uh there's more technical things that you could do to make things smoother or choppy or whatever there's we'll get into the animation stuff later um right now I want to show you how to animate um it it uh your animation directly in unreal and not bringing animations from Maya but we can go over this as well and I'll probably do that at the end uh for now uh I want to just EX Port this so make sure it's always like your models in the middle right where um this panel is the panel is right here click on that make sure it's in the zero location so that's easier and unreal when you bring it in and go ahead and select your whole model that you want to export and go to file and then go to export selection and then we're gonna go to the folder that you want to export into and then go over to this section and you're going to click on animation constraints and cons and skeleton definition you're going to go over here you might not have fbx or object files in here and if that is the case all right I believe it's go to Windows I believe it's plug-in manager and then you're gonna go scroll down in this you're gonna look for um fbx and you're gonna you're gonna click on it you're gonna check these off and then you're gonna go to FB J and you're gonna check these off and you might refresh and close I'm not sure quite if you do that or not but anyway you're gonna that's gonna add that in now go over to uh export selection and now it should be in here if it wasn't already so we're not baking an animation because we do not have an animation that we made but if we did we would bake it and then we put in the uh time that we made it and then if you were doing scanning you would you would check on this and we'll just go over all that in the future when we do more advanced animations so go to your projects file where you're saving everything and go ahead and save your uh animation rig for um lesson three all right so now we're um just real quick we're gonna make a quick little animation uh so actually how to do that later so click on your second joints press s then like go to 30 and move it like up and then press s and then I want you to copy this by holding down shift and highlighting it right click go to copy come over here to 60 and paste it now I want you to uh select everything actually go to Joint one go to one and then press S as well okay now I want you to well I'll show you what that looks like playing okay now I want you to highlight everything export selection this time we're going make sure you've got animation clicks fake animation we're going to end on 60 because that's where we animated it and go ahead and call that uh I went ahead and clicked on that so it copies the name and then I'm gonna do um animation actually I'll do baked Justice so it knows it has a baked animation on it and then I'll do a one after that all right so export that now let's go back to our Unreal Engine and we're going to um create a folder called um uh rig one lesson three whatever all right so we're gonna create two folders one is the rig and then one is going to be the animations are the baked animations you don't want to make your folder titles too big because I don't know why but they've run out of room if they're too long um they like them short um if you're gonna do too many holders within folders so import your rig that you just made I'm always forgetting what I'm doing it's right here actually all right so yeah click on the rig that you made and you're gonna click on skeleton mesh don't put anything in here don't put do that just leave it like all that leave it like it is and for it all okay now in the baked animation we're gonna import uh the baked animation we made and yeah we're importing the mesh we're importing the animations as well and and for it all all right so in the rig we're gonna uh right click on the skeleton mesh and you're gonna go to create a control rig you're also going to create a blue an animation blueprint it's automatically gonna name it um whatever your rig is click on the control rig so basically what I'm making right here is I'm making a rig within unreal that we can actually animate in unreal engine um using the rig that we made in Maya so how we do that is I'm going to let me try to remember okay um for each one of these do control n so for this Ctrl n here Ctrl F click on here Ctrl n Ctrl n Ctrl n okay now I want you to we need to hook these up and how we're going to do that is I'm gonna um we gotta uh hook up the right ones with the with the corresponding uh the gotta hook up the bones with the corresponding control and how we're going to do that is go ahead and um undo unparent them by um shift p so click all the controls it should be to unparent them and then what you're gonna do is you're gonna bring over the control and you're gonna hit set and then you're gonna take the same bone of the same name and you're gonna go to get let me just test this actually before we do that I want to make all these controls uh different smaller so you can see it better click on all the controls go to shape properties and change it to a thin Circle like that now we can make it smaller so on the shape transform let's go let's make it point two yeah that works okay so now let's hook this up and just test it to see if it works I'm gonna drag value over to transform that would be this controller when I move it doesn't do anything and it wouldn't because just give me a moment um let's do this one this would be set and then get hook that up okay now I think this joint I could test yeah okay so it works so keep doing that for each of the bones for uh objects or for mesh one get okay now for mesh two cell phone and then get oops okay and then fresh to set bone get mesh now save now we're gonna put these in a hierarchy the drag you gotta match you know this guy so we have the joy under the control we have joint two under joint one we have mesh one under point one and we have mesh two under joint two like that so now when we move the rig you gotta give it a second sometimes it freezes system it's saving come on start freezing on me there we go okay sometimes it raises for a while all right so now you can see that it works um if I'm moving joint one now only joint one works so save that come over here into your scene and drag over your control rig into the scene let's go back to our see what we actually babes yeah none of that saved great all right well let's do it again so annoying all right so bring in your rig small so let's make it bigger so uh I I made it bigger and over here in the scale over here so uh I added in 10 10 10. so we have our control rig that we brought into the scene I want you to click on this ring and press s I want you to click on this ring and press s then I want you to click on the top right here right click and go to bake animation sequence go to bake animation folder and then go to uh bought a right type and bottom idle so this is when it's still and it's at the bottom two times spell that yeah I did okay and then export that go ahead and save your game so now okay where did my rings go there they are okay so now I want you to move over to let's see 60. and I want you to grab the first ring and I want you to pull it up and press actually yeah okay I want you to pull it up and press s and then I want you to copy these by highlighting it and then go click Ctrl C and then come over here to 120 and I want you to do Ctrl V to paste doing this and I want you to go over to animation rig and then I want you to right click and go to bake animation sequence go to your bake animation folder go ahead and name it going up or actually moving you know what cancel that I have it going back down but let's not do that let's drag this key all the way to 120. that way it's just going up and that's all we're gonna bake so go to bake animation sequence fake animation and then name it going up export it now I want you to delete this and drag this guy all the way to the beginning and then go to animation big sequence sure go to um go to big animation and then go to um up idle I'm going to type in up idle and then hit OK export that save your game in case we crash and then uh we need a going down so now we need to unduce uh some of the things we did by clicking on here and then doing Ctrl Z to bring everything back so now I need to separate I need to make this over here and this one over here so I'm going to copy this by highlighting it Ctrl C come over here Ctrl V delete this move this guy over here and then move this guy over to the 60 Mark where we originally were so now it's going down so now I'm gonna export this go to big animation type in going down then hit okay export save okay so now when we go to our folder big animations they should all be there okay so now we're gonna go to our animation blueprint that we made so how you do that is you go to your con your skeleton mesh and you're going to right click you're going to go to uh create uh animation blueprint we've already done this but if you didn't this is how you do it and then click on it so right here you're going to drag and you're going to write in a State machine we're going to make a state machine and we're gonna name it well it's gonna let us name it sorry um um click on it okay now we're gonna uh go to the entry and you're gonna drag it out and you're gonna add a state so the state that we're gonna start out is uh idle down idle so down idle state then you're gonna drag this down and we're at another state and then the next state is going up going up state then drag it down again next state we're going to add is um up idle state and then again we're gonna go we're gonna do a going down state and this is um the direction that it has to go in because this is how it's going to execute those animations so uh and we hook that up to the first one so we need to actually have two of these so what you're going to do is you're going to drag this down again to each one so that you have two if you were gonna have the ability to be a down idle and then you would never be going down after being down idle so you would never have it like this but you have like that ability if you were doing animations that you could transfer over to different states like that so you do have that ability to do that but okay so what we're gonna do now is we're gonna Click on each one of these states and add in the animations so this is the down idle state so we're gonna find our down idle it's actually I X I named it different I named it bottom idle but it's the same thing and then connect that file save now we're going to go to go back to with this arrow click on the going up state and we're going to hook that up compile save why is it giving me a warning that's weird okay idle going up um going up doesn't look right not sure why what happened there but uh let's do this again so we have it going up so I'm gonna switch these again so move that to 60 move this to the beginning so that we're going up and then I'm gonna export that not export it sorry I'm going to bake animation sequence go to bake animation going up and I already have one that's going up so I'm going to add a one in there just so it's different differentiated and then I'm gonna hit okay export it save it um let's come back over here to our bake animations let's go back actually let's go back to our break go to our animation blueprint and let's see should be right here straggle it over connect it and it's still giving me an error oh let's check and see if it works it works so it might be giving me an error because I haven't yet hooked it up um like I have we need to continue the process so let's just keep going and we'll figure it out so go back over here go to the up idle State and we're going to add in up idle sequence save and go back go to going down state add that in okay now we're going to go back here and we're gonna um add in some variables so go to your variables and we're gonna do booleans so for this we're going to say down idle uh down idle uh let's do that for state all right so duplicate that but now we're gonna do uh going down state now duplicate that and we're gonna do going upstate and then duplicate that and do uh excuse me up idle state foreign make all these public I'm pretty sure we're gonna need to make those public because we'll probably call it from another script uh I mean you can do it within the script but I will probably call it from another script so I want to have that capability so make it public and then we're gonna Click on each of these guys so click on the first one and now we're gonna say uh down idle get drag it over and then type in knots not bull and then connect those and save it and then come to this one and then we're gonna go to the one that it's going into okay so it's not the down idle because this is down idle so it's like it's not so it's now it's moving this way because it's no longer gonna be down idle so now it's on this one this one is going up so we got to put the going up in here and get connected but we're not doing not because we are saying yes it's going up so now on here we're gonna say no it's not going up anymore so we get it and then we drag it go to the knot bull and connect that and save it and then on this one it is going uh is no longer going up so we're gonna get it and we're gonna go knots going up connect that I think I forgot one yeah I did so this one's uh says yes it's going up so we drag this one over get connect that sorry for skipping it um so this one is the going down so we're going down now so get it connect that and then this one's not going down anymore so going down and then we got the get the knots connect that and then on this one we're gonna say it's down idle again because it is down idle so we're not doing the knot on this one so now uh it's working it's functioning um now when we click on this it's actually working now that's why I wasn't working before okay so save it uh this is your uh animation blueprint so how I would go about doing this I might have like a gate on it just so that's not always running all the time to create a custom events and another custom event copy and pasting name It Animation [Music] active uh animation inactive you probably want to make it a more specific name obviously for a game but I'm just doing generic right now let's go ahead and bring these out over here because I'm gonna need them later probably I'm not sure if I'm doing it right because I know that it's hard to access animation scripts I'm not exactly sure how you do it so how I do it is I make like a variable public and then I call it from I think this script uh and then if that variable is public then or if that anyway we'll get to it so um for now I do want this to be active so I'll do a sequence um so that it activates this only once so we're not constantly running it and then it goes through the gate so it's just automatically opening that gate and then I can manipulate this later as I need it so to kind of demonstrate how this will work let's let's do it on a switch so let's do some custom events stay down go up stay up and go down all right so how it's gonna do that is it actually needs to interact with these guys so uh just drag get all of these actually set them so drag them all over here and go to set these are all our Bulls so for it to stay down I need all of the rest of them to be false and only stay down to be true for going up I need all of them to be false except for going up for stay up I need all of them to be false except for up idle and then for go down I need all of them to be false except for go down I like to put the floss first and then connect them now over here we're gonna create a switch so switch on end and we're going to add four pens so the way that game design works is it's never starts on one it always starts at zero so technically three is four um we're gonna go ahead and copy paste it in here so you can pull it up rename it copy the name click on the window right click paste in there then click on it it's just an easy way just renaming it just to copy the name okay so now I need to hook this up so it needs to be in the right order so it's going to be stay down then go up then stay up then go down so it is in the right order so go ahead and hook these up do you follow me stay down because that's the original um hook that up to the gate and now we need to make an end it's called Uh change it to an integer and then call it Cube moving sweat it we're gonna make that public I think I mean we might have to access actually an end from [Music] um another blueprint but for now uh we're gonna do it from here I'll show you uh go ahead and connect that so now whenever this ends is uh turns to these numbers this will happen so how I would do that and just to demonstrate is let's copy the sequence so that I can do another action over here so I'm gonna do like I'm gonna set it to zero and then I'm going to do a delay for like a second and then I'm gonna set the end to one and then I'm going to delay it another second then set the end to two sorry did that wrong one second and then set the end to uh delay it again and then set it to three to lay it again and then set it to four and then back to uh zero so now let's see how that plays out sometimes uh when my stuff crashes it doesn't save the animations what I'm going to do is I'm going to save it I'm going to close out of unreal uh that way it makes me save it I'm Gonna Save everything and then I'm going to reopen unreal reopen my projects so that it doesn't delete my animations every time it crashes but it's actually saved in there I'm gonna open up my project there's probably a better way of doing this but this is how I do it now um open up your scene and then go to your where you saved your animations and then you should still be there now sorry now uh bring your character into the scene by dragging them into the scene like this I don't know why it keeps doing that all right so what I push play you could see that the animation works it's getting stuck in a spot though I gotta see why it's getting stuck in the up idle States I think I know why because it's continuing to run this it's just running it all the way through so it's good or not so we're gonna put it we'll do do what just to control it so it's not constantly running it I don't have it timed right that's why it's being all weird I was just showing you how this would work um let me see what it looks like when it's playing I'm not giving it enough time delay I think so we did 60 it's probably two seconds so let's see what happens yeah so yeah um to activate an animation from like a blueprint we could say we could do create an actor and we'll make it call It Animation controller BP sorry guys and then um we'll add in nothing just go to your blueprint and then we're gonna go we're gonna uh create a an integer and we're going to call it uh animation control and change that to an integer and then make it public then come over here and we're gonna uh after do once we're gonna get uh cast to animation controller BP and sorry we're gonna go to get uh actor of class actually and then we're gonna go to animation uh animation where are you there it is so then we're gonna right click on this and then go to promote variable um you could leave it like this but I prefer to change it to actor just because I um it's the old way of doing things and I don't quite understand exactly the new way of doing it yet uh I'm sure it's very simple but I just do it the old way um animation excuse me blueprint our animation controller Factor and then drag that over well it's already here and then we're gonna uh go to cast to animation controller and then connect that now when we we're actually going to pull up so I want you right click and pull up uh Anna Nation control blur uh uh get and copy this so you can pull it back up and then also set ends and pull those back pull those up so I want you to connect this now to the here and then connect Target to ha that's not it animation control blur cast to animation I have everything misspelled sorry about that guys I type way too fast I'll fix that okay so sorry I'm just getting track of what I'm doing and uh me oh that's why because I was misspelled right here oh so dumb okay cast your animation controller there we go come over here let's fix this there that's why I was giving me such a headache okay so now we can connect it all right so now it's gonna be reading it from there and so now we're not using these switches now we're gonna we're actually gonna control this from this blueprint so we're gonna set it on here and maybe we want to do that by entering a box so let's add in a box Collision sorry I uh sorry I keep coughing okay so we added a box Collision we want to be able to see the Box Collision because we want to be able to see it when we walk in it so I took hidden in game off now when we enter this box when we begin overlap and also end overlap uh we need to cast to our player pretty sure that's him and when it enters the Box it's going to set our animation to um one and then delay for two seconds and then it's gonna set our animation to two so that it's like idle and then we'll do the same over here when you exit out the box it's gonna set it to three because it's gonna actually this is zero no no no it's not no it's not I got it right okay so that's three and then you're gonna turn this one to zero because that one's the idle down okay so now let's test it we're gonna bring in our uh box controller our animation controller blueprint into the scene let's make it a little bigger this will be easier to run into all right so whenever I run into it uh this animation should activate and then when I leave it it should well it did it automatically that's not very good but let's just see what happens okay I might have it an opposite ends it's working it's not working exactly how I wanted it to okay and probably because it's directly on here so what I'll do is I'll create a custom events going up and then custom event going down go ahead and bring those over here and then it's gonna actually be pretty involved which I want to get into in a later time how I would go about controlling this but yeah it works it's working now if you go here you could see that we already have an animation and it looks like it would allow us to add it in so let's try that let's see if we can add it into our um State machine that we already created so go to your blueprint animation and uh we're just gonna we're gonna go all the way back to the beginning and I'm only just gonna put in this script that we baked and brought in from Maya just a test to see if it works than it does on the same rig
Info
Channel: The Shoun Files
Views: 427
Rating: undefined out of 5
Keywords: unreal engine 5, unreal engine, unreal engine tutorial, unreal engine 5 tutorial, unreal engine animation, animation in Maya, Maya animation, Maya rig, rig in unreal engine, unreal engine rig
Id: 3FeytMFmylQ
Channel Id: undefined
Length: 83min 26sec (5006 seconds)
Published: Sun Aug 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.