Blender 2.8 to Unity 🐧 - Animations (Idle, Forward, Left, Right)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey we're back with our penguin he is rigged and wait painted and ready to be animated a bit before we export him to unity so if you haven't been following along make sure to check out the previous videos and see how we can rig a character like this and just to show you where we're at at this point you can move these bones and it will deform the mesh appropriately this is a simple model and as such we're going to do a pretty simple animation and I'll show you some hints at how you can come in and make this a little more interesting but for now because we're more focused on the transition from blender into unity we're going to take these bones do very simple animations and then go through that process so first off if you have your mesh open but you can't see the bones or the names or something like that come over here onto the right side this is in blender 2.8 the little guy here this green man symbol running person symbol I should correct that and the the things you can display are in front so if your bones aren't showing up you can click in front you can choose axes to show or hide the axes I like to keep them visible just so that I can see which direction I should rotate and then also the names I like to keep these on as well because I know which bone I'm working with and it makes me not be lazy and accidentally call something boned 0:03 or something like that so animation in blender is not the most intuitive part so hopefully we can go through this in a productive way first I want you to come into this animation tab this workspace and then we're gonna do our work in these two windows and then sort of just visualize and and manipulate some things in this window so the first thing I want you to do is in 3d in the 3d view hold your mouse over this area and hit the N key and that'll allow us to see these trans these transforms okay and we're going to basically modify a few things to do rotations we're gonna create an idle animation moving forward animation a turning left and a turning right so that we can bring this into unity and control it with the keyboard so that we can slide around on his belly so first thing I want to point out here is that we have rotation is set up with quaternions and quaternions are the mathematical way that 3d programs can manipulate rotations without having some of the problems of the XYZ rotation the main problem with it is that it's not very intuitive for us as humans or at least not for me and I like to work in X Y Z Euler so that I can think about oh I'm going to return it this much around the x axis and then then this much around the y axis and so forth so I would recommend if you're going to work with these things you can change this into XYZ and then we'll be able to change the like Z rotation and turn his head so I'm going to hit control Z to undo that now I'm going to switch this box right here into the curve or the sorry the graph editor and we'll be switching back and forth between the graph editor and another editor but for now we're gonna add our first animation here and because unity starts at frame 0 instead of frame 1 we're going to change this window down here in the bottom right corner to 0 and you'll notice that this kind of pops over here and now there's this black line so it starts at 0 and if I hit this jump to the first last frame it'll jump to there so we're going to start by creating an idle animation and the way I want to do this actually is I'm going to go into the action editor here I'm going to choose this drop-down go into action editor it looks pretty much the same but it's going to allow us to separate these things into different tracks so that we can create our idle create our moving and turning and then they'll be imported separately to unity instead of all it's just one sequential path that we need to split up manually so you should have this button here that says new we're gonna click new and it's called action we'll come back and we'll rename this in a moment so for now I want to for our idle animation all I'm gonna do is I'm gonna just rotate his head back and forth so idle typically you would have like maybe the wings would move maybe he would breathe a little bit maybe he would wiggle his feet chomp his beak a little bit but to keep things simple when he's just standing still I'm gonna have him look back and forth a little bit so select the head bone here and then hit the I key on your keyboard and what we want to do is we want to insert a keyframe for the location and rotation so that's going to lock in this zero zero zero here on frame 0 and then we want to go forward some number of frames let's say we'll go to frame 19 so that's 20 frames in since we're starting at zero and then I'm gonna rotate the z-axis maybe negative negative 10 I'm not going to be perfect with this then I'm going to hit I again location rotation and now I'm not actually changing the location of this but my experiments have led me to find out that if you don't do location and rotation when you put the keyframe it doesn't seem to work I think that might be because it's moving both the it's rotating but it's also moving this this part of the bone in space so I don't know if you can find a way to get it to work with only rotation go ahead but for me just locking in the location and the rotation see to work best so we can hide that we don't need it visible and then for the next one let's go to about 39 and we're gonna change this to more of a positive number positive 10 use the I key to insert another one with location rotation and then we're going to bring it back maybe here to zero and then hit I and location rotation so now if I shrink this down you can click on this and you can kind of shrink it down to maybe the last frame here 59 and then if we play this it should kind of loop this animation okay so this will be our idle animation and we can change a few things if we want to you notice that when you play this he kind of brings his head to a stop for a second in the middle but maybe we don't want that stop let's change that so this is where this curve or this graph editor comes in handy you can edit the curves of how this thing appears and as you can see right here the graph is kind of hard to see we can fix this a couple ways one that tends to work is if you use the if you hover your mouse over it and press the period key on your number pad then it should focus in on this if for some reason that doesn't work if it kind of focuses in on it but it's not quite right you can grab these little circles here and you can change them as needed to sort of fix your window view the same thing works here pretty much anywhere in the editor if you're trying to work with it you can move these little circles as opposed to just the bars because if I'm just trying to use the bars and it's it's not focused incorrectly it's not going to go well but these circles can really help with that but we can see this pretty well I'm actually maybe I will shrink this down a little bit we have what's what's happening here is we have these curves that are kind of coming to a point here it's going slow then speeding up and then kind of doing this sine wave and then slowing down at the end that's why we're seeing that kind of blip at the end it's slowing down and then speeding back up again instead of just doing one continuous motion as it as it continues in loops so let's fix that the biggest problem you'll have is if you try to grab that point there's a bunch of other lines here that are in the way so if we expand this menu we can actually hide the locations and we can hide everything but the z-rotation remember we were rotating around the z-axis here so we'll hide these by clicking the I symbol and then we only have this Z Euler rotation showing we can select this and we'll smooth it out by just grabbing this okay now we could mess with these and try and make it a smoother curve but I'm not going to bother with that now you'll see that it's a much smoother transition in between if you look over here there's no jumping that happens okay so this is our idle animation and we want to rename this and kind of get a fresh template for our next animation so we're gonna switch this view here from the graph editor to the nonlinear animation editor here and you'll see up here that we have something that matches the name of this action so I'm going to double click on this and I'm going to call it idle and hit enter and then I'm going to click this symbol push action down onto the top of the NLA stack as a new strip okay so now we have idle in here in this NLA track you can rename this if you like I don't think it makes much of a difference because we're going to be exporting this into unity but now you'll see that not only did that get pushed down into its own track it also cleared this out for us so we can create a new action that will show up in another track now I want to just point out something that took me way too long to figure out so if you are working in here and let's say you created a track that you didn't like and one way you can do that is with this menu you can add a track so let's say I've I have a track in here that's cluttering it up because maybe I created an animation that didn't end up working out if you want to if you want to delete this if you were to select this you can't even tell that it's selected but it is by the way you can rename it same as you can do the other thing you can double click but if you select this and if you move your mouse over here and you're not thinking about it and you hit delete then it's going to delete the selected idle thing and now that's now that's not in a track anymore so I'm gonna undo that because that's not what I wanted to do if I select this and keep my mouse in this area and hit the Delete key it deletes that track it's kind of like when you're working in different windows like you hit a key and it does a different thing but this one really got me because I'm not used to having this you know there's not really much of a separation between these two windows either way now you know you can delete those you can also delete them from here as you just just saw it's just whether something is selected or not before you delete it okay so we've got idle now I also want to do something really quick before I forget this armature we're gonna rename this to penguin no it doesn't like that so a reason is because over here we've already got something called penguin if I'm gonna double click on this and call it penguin underscore mesh so that it's distinguished when we pull it into unity and then I can double click over here as well and rename it to penguin it doesn't really matter where you rename it but this way the armature is going to show up as being called penguin and these animations are going to be imported to unity as penguin and then one of those sort of straight up and down slash symbols I don't know what it's called a pipe maybe the one that's basically right on the same key as your as your backslash key but with the shift enable it's gonna be that and then penguin Idol penguin forward so that just helps make things a little cleaner when you import it to unity so now we've got our Idol we're gonna get to our next animation so we're gonna create a new one and right away if you want you can rename this will call it forward and we're going to do a pretty simple animation we're going to check grab the root here and I'm going to over the course of 60 frames well let's do 30 frames actually for this I think this will be something that goes a little quicker maybe he'll be moving one meter per second we can always tweak this later but we're going to move this root bone from here to here so I'm going to first of all make sure I'm on frame 0 and hit the I key and I don't need to change the rotation for this one so I'll just do location so we've locked in this 0 0 0 position and then I'm going to move him forward or forward for him is actually the negative y-axis so this this direction coming this way and so I'll set this to negative 1 here and then oh shoot undo that control Z I need to move forward the number of frames first so I'll go to frame 29 and then so that's 30 frames forward and then I'll do negative 1 here and then I'll hit I location and then if we just try animating that it's going to do that now one thing that you'll see that's happening is it's doing the idle animation on top of this movement which in this case is fine but if we had done something else if we were doing the turns for example it's gonna start turning and moving forward at the same time we don't want that that's just a matter of up here in this nla editor just unchecking this and it will play this top one so if I just hit play now he's not moving his head okay so that's looking pretty good to me the only thing that I want to change about this is I want to open the graph editor and let's isolate the just the Y location we'll hit the period key on the number pad to view this by the way if you don't have a number pad you can go into here and go to view and view selected you see it says numpad period here so that'll allow us to do the same thing and then you can change this to linear because right now if you do it this way every time he moves he's gonna go whoop he's going to kind of do little hops so we we're not gonna grab the points this time we're actually gonna right-click once we've selected this we're gonna right-click on it change the interpolation mode to linear so that it's just a smooth transition or the smooth movement the entire time so it doesn't slow down at all and then if we press play it's just gonna go smoothly and we'll be looping this in unity so you don't need to do anything special to loop it now okay so we've done that one and we're ready to push it down and we can actually push down from here if we click this push down it clears this out we can go back and look at the nonlinear animation thing and now we've got forward on here and this is checked so we want to uncheck it so that it's not playing while we work on our next animation so let's create a new animation we'll call it well we can't actually rename it from here sorry we can rename it from here so I'll call this turn left and we are going to just turn the root bone some amount to the left and so I'm going to lock in the current a location and rotation of this with the I key and then we're going to switch this to XYZ Euler we're gonna go out 30 frames well I'll go to 29 and then we're going to rotate around the z axis Z and this bonus is pointing straight up so maybe we will turn and we want to make sure this is actually turning to his left which it is let's turn 30 degrees and then I'm gonna hit the I key and set that location or rotation okay let's switch over to the graph editor and let's obey we have a lot in here so I think what happened here is because I had not changed this when we created this keyframe it was locking in the w x y&z from the quaternion and the XYZ here I'm gonna do is just select these and delete them I hit the X key you can hit the Delete key as well delete key frames and then let's set this to zero and then we'll do I to lock in the location in the rotation now we're only seeing these six ones so because we're rotating we know we're rotating around the Z we can hide all of these and view we want to view our curve so let's hit the period key and see this is an example of when hitting the period key does not really work very well so let's see if we can get this to show up properly by grabbing on that circle and then driving on this one way good thing we have these tools so we want this to be a linear one as well so we'll select it right click interpolation mode and then linear so that'll make it turn left very consistently as we keep turning if we loop that animation so this is ready to go we're going to push it down onto the stack just double check this make sure that this looks good and then we're going to uncheck it so it hides it and then our last animation that we want to do will create a new one we'll double click this to name it turn right and we're going to animate this turning to the right so this it's already on XYZ so what I'm going to do is hit the I key lock in that lip location and rotation go to frame 29 again and then I'm going to rotate the opposite direction turning to the right so negative 30 this time and then hit the I key location rotation okay so this is now on here it's it's almost ready let's just set the graph editor we'll hide all of these and we want to set this to interpolation mode linear and we'll push it down onto the stack and so now in our non linear animation view we've got all these I'm kind of curious if I turn them all on at once what happens he's kind of he's trying to turn and do a bunch of stuff at the same time it doesn't work well whatever leave it unchecked so now we've got all four of our animations on here and we should be ready to export this so we're going to go to file export FBX and the only things I want to change here our FBX unit scale and you might want to check just to see in armatures and well sorry not armatures and animations you can look and you can see that it's it's sending out the NLA strips and all actions I would just leave it as is you might be able to make a cleaner export if you mess with it but I'm not going to mess with it so I'm going call this I'm just going to add animated on the end of this and export it and then we're going to bring it into unity we're gonna come in we're gonna right click import new asset bring in this guy and then we should if we did everything right have a number of clips here penguin then that pipe forward and so that was the benefit of renaming this armature to penguin here and this mesh to penguin mesh because it'll make it nice and clean and when you expand this you can tell which one is the armature and which one is the mesh by having renamed it to that so that's that's pretty cool the other thing you want to do when you have this imported right away is going to rig and make sure that you change the root node to under here penguin root so that's going to make it so that when we do something called applying root motion it will use that root motion appropriately root motion basically means it's going to move the penguin if we've told it to move the root bone so when we turn if we loop that it'll just keep turning if we go forward if we loop that it'll keep going forward so all of these now that we have in this animation tab we also want to loop them so I'm going to come here and click both of these checkboxes to loop them same thing here same thing here same thing here and I'm going to apply and then let's just preview some of these animations so down here you can see that as he's looping because we've set the root bone he's just moving forward continuously idle he's just going to kind of look back and forth turn left and turn right now this video is probably getting a little long so let's call it a break for here and in the next video we'll come back and we will hook this up to player input and blend node so that we can control this thing and have him slide around on our snow you
Info
Channel: Immersive Limit
Views: 38,638
Rating: undefined out of 5
Keywords: nla track, blender action, unity root motion, blender to unity, blender 2.8 export to unity, blender 2.8, unity, blender 2.8 armature, blender 2.8 animation, blender animation, blender 2.8 bones, blender 2.8 skeleton, blender 2.8 rigging, blender rigging, blender bones, blender move vertices, blender animate vertices, blender vertex animation
Id: jH-VofVFsFo
Channel Id: undefined
Length: 24min 55sec (1495 seconds)
Published: Sun Jun 23 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.