Blender Animations in Godot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
greetings my name is Brian Carey and I'm gonna build a video game today we're gonna learn how to take objects from blender these are objects with armatures and animations associated with them we're going to move those over into the Godot game engine and we're going to get those working via script and we're going to get it working in our game engine the tools of the trade we're going to use today our blender version 2.8 to a and Godot version 3.1 now to be completely honest there are a few provisos a few quid pro quo as a few caveats so you're gonna have to pay attention my name is Brian Carey and I am the savvy barbarian [Music] [Music] welcome back okay as I said we're going to work on how to get our objects with armatures and that's the the bones that are inside or the skeletons that are inside of blender and the Associated animations that you put your character or objects through we're gonna get those over into the Godot game engine we're gonna get a list of working and run it through a script this is important because armatures are one of the critical pieces of your animation toolbox so if you're going to be doing a sword swing if you're going to be doing a walk cycle or just about anything else you're gonna be using armatures and you want to build those animations I think the the process that's been easiest for me is to build those animations in blender it's really good at giving you those tools to to make things and do your animations easily it's meant for the artist then once those are built in blender we can just run them in Godot and Godot actually gives us tools to blend between the different animations that we've made in blender but that of course is fodder for another video on another day let's jump over into blender and I'll show you exactly how this looks this is the construct no I'm just kidding this is blender so this alright this is a game asset that I've made that I'm probably gonna put in to my video game don't steal my idea guys I'm trusting you I'm showing some of the I'm letting the cat peek out of the bag here right so don't steal my idea and you're already going your idea you made a crate how's this your idea this is have you never seen crash bandicoot have you ever never seen Mario breaking blocks with his head this crate thing is not new I know that's this is true part of the standard video game trope is to make a crate it's a great it's a great thing it holds stuff or you do things with it you can push it around jump on it how cool to my favorite video game franchises portal and half-life make extensive use of crates and that's partly why I'm gonna use this because mine is a little bit special because mine does this Wow that's right my crate fights back let me explain this is this video we're not going to go through all the things that we're going to do to create the object we're not gonna make it match we're not gonna build the armature or parent it or set up the groups or any of that stuff we're gonna assume you already know how to do all of that if you want me to make a video on how to do all of that that would be actually quite a few videos and I could do that and if there's sufficient interest I will but if this video all we're gonna do is assume that you already know how to make an object build the armature you've parented the armature to your object and and you want to know how do I make the animations here how do i how do I do that what's the next step in the process so I'm gonna show you that real quick this is a really simple rig so we show this in you switch to object mode and I'm gonna go over here and turn the bones on in front so if you can see inside view all this is is we've got a bone here that I can use to partly control the tongue I'll use a shape key for that also and then we've got a spine here that's just going to hold the box still and this upper section here that's to flap the top of the lid so that's all this is it's real simple but it doesn't matter if you've got two bones in your rig or if you've got 200 bones in your rig the process is gonna work exactly the same way so we'll just start with something simple because it's easier to learn that way so let me turn that back off and what we're going to do to get our objects over into Godot is we're going to use the NLA editor so if we click up here and pick a new thing here it's called the non-linear animation editor so give that a click and just select just the active objects that I'm playing with here and what this is going to do is this is going to contain the different animations right so you may have a sword swing you may have a walk animation you may have a headbutt I don't know what you're going to use but all those different animations all of your animations will go here and from there they're all going to go over into Godot so let's make two of them real quick and I'll show you how that looks so I'm just gonna start here on frame number one and I'm gonna go to my armature go into pose mode and clear the rotation so on frame number one I will insert apparently nine times no I need to do it one time I'm just going to insert a rotation and that's it so frame 1 and then let's say this is just gonna be let's just open the mouth this will just be like a yawn that sounds like a plan so let's say that takes at 30 frames a second let's say it's a nice dramatic yawn here so at frame 30 we'll just rotate that up - how's that look that looks pretty good there you go that done so we'll do another insert of a keyframe and we're gonna pick a rotation again and here we can see our two keyframes in the NLA editor so everything is good so what you're gonna do is this is named mimic armature action which is rubbish so I'm gonna double click this and I'm gonna say this is a big yawn excellent so now that we've got this what we're gonna do is this is the magic button right there this guy pushed down action so when you push this button to feel more powerful you should say by the power of Grayskull look at the button there you go and now what we typed for the name is going to pop down here and I said to change the name when it was up here because now that it's here I have no idea how to change that name but this is the name right here that's going to end up in our Godot game engine so to me it's very important that we name these things appropriately so I can figure them out later so if I click play here you're gonna see it's just gonna play that animation there it is you want to see it again yeah that was it'll be scarier with music trust me so let's say we want to make another animation so you've done your walk cycle let's say that was your walk cycle and now you want to do a jump or you want to do a sword swing or something so you've pushed this action down and now you've got this guy over here and now you're free to do it again you can just turn this one off and it doesn't show up anymore and that's nice and then uh this time let's make him do like like he's gonna do an evil laugh so though the lids just gonna be like ha ha something interesting like that so we'll do the same thing I'm gonna come over here to buy side view on frame number one we'll do an insert of a rotation keyframe and let's say by frame I don't know let's say 10 the rotate opens his mouth real wide and we'll put in another rotation keyframe and at 20 he's gonna close it a little insert another keyframe and so 10 and 20 I can repeat a few times so here's I'm gonna briefly quickly hopefully pop open my dope sheet so what I really want is just these last two keyframes I'm hit shift D I'm gonna duplicate those a couple times like that that that yeah I'm just gonna leave his mouth state open at this point at the end of this so let's just see what that looks like hahaha that's the slowest evil laugh I have ever seen so let's just grab all of this stuff and my cursor is here on frame 1 and obviously asked to scale and scale that down a little bit here making laughs bit faster how does that look ah ha ha ha ha hope doesn't turn into a ringtone ok so there's that so now it got our evil laugh and once again we got to push this magic button right here by the power of Grayskull so this is gonna be called evil laugh okay ugh evil laugh by the power of Grayskull click and now we've got an evil laugh and we've got a big long yawn so if I scrub through this I can see him do his big evil laugh and if I turn the other one on by clicking on this and hiding that one you can see he's just gonna do that yawn and so you can make as many animations as you want and you should any specific action that your character or your player or your villain or whatever your is just keep popping those in here now I suggest a couple of things here one I strongly suggest that the origin point of your object and the origin point of your armature are the exact same point in 3d space right so if you use just go to set origin and change them because if they're not the same spot I've just had that cause issues in Godot where all of a sudden the offset that I had left in there it caused some strange issues for me and it was just it just so many problems went away when the object and the armature were in the exact same spot and preferably the world origin it just makes your life so much easier trust me on this one so now that we have this mimic looking all scary and doing his evil laugh and doing this big yawn or whatever your list of animations are in here we're gonna export that all over into Godot now you're gonna have distinct animations here and I suggest to make it easier for you to blend them that you find like a neutral position so it's easier so you don't like jump from one to the other however there are ways to solve that it's just gonna be smoother if you plan the start and finish of your animations so you could say daisy-chain those together now Godot provides tools for how you can blend these animations together and it's pretty sweet but that is fodder for another video on another day so now we're going to export this over into Godot I'm gonna have a link up in the corner here and probably put a link down in the trumpery down below so have a look at that video to sort of help you jump through the workflow he'll that sometimes shows up when you try and transfer your objects from blender over into Godot it's not that bad I think the video is actually pretty helpful so here we are in the Godot game engine and as you can see the crate came over exactly right and you can see the layout here it comes over as a spatial node here so this is this mimic this name is exactly the name of the object that we had in blender which is perfect and this skeleton here the same name skeleton that is your armature that's the armature that you had built in blender and this actually contains all the bones and all the rotations and all the all the stuff that you had there this here is your mesh object and your mesh object and even in blender is separate from the mesh is separate from the object data those are usually two completely separate things what we've got here this guy this animation player is what stores all the animations and as you can see here look we've got big yawn right here and we've got evil laugh so we can play those guys and the other one here is big yawn so we give that a click there raw wait so so so are you seeing this are you seeing this wait have a peek at this and blender again this is this is what it looked like in blender yeah yeah this is in blender this is what it looks like in Godot what is that look at this before after see what I'm not seeing there's no bottom teeth in this one where are my bottom teeth why did that not come over is like is my mimic now supposed to like gum adventurers to death where why ha you know what I'm not upset I'm not upset I got this I'm good I'm not upset okay so here's what happened and I don't actually think that this is a bug but this could just be my own stupid but here's here's what actually happens all right so let's jump over into blender again real quick and what's going on is the reason the bottom teeth didn't come over is this if I click this object we go into wireframe mode to make it just maddeningly confusing but you can see in here I've got I've got teeth in there right and if you can tell that's what that is but I do so I've got a vertex group over here it's called teeth lower let me select all those and there's all my lower teeth and though that's all the stuff that did not come over and the reason is because once you have an armature as a parent to a mesh then you need to have every single vertex in your object in your mesh every single one of them needs to be associated with an armature bone at least one if you don't have any association with an armature bone it just doesn't come over cuz that's not important so I'll go to do fix this is I located the vertices in question and I just need to associate them with the group here in my case it's called spine and I'm just gonna give it a weight the spine is like the bottom of the box so I want those to stay with the bottom of the crate so I'll just click a sign here on the spine and if the circuit gods are in our favor this should all just work all right now back in Godot let's have a look here we click on our animation player and there's there's the big yarn and a click play and bottom teeth for the win okay so now all we got to do is figure out how to access these animations in our Godot script we're gonna choose the parent item here and we're going to click this little invoke magic script button I'm gonna accept my defaults of Gd script click create' and let's just do something really really quick and simple we'll just make it if I press the spacebar it'll yawn I press the Escape key it will do the the evil laugh and that's the end of it so this is actually super easy so what we're gonna do is we're gonna click we're gonna take the function input and we're gonna say if is action pressed and if the action is pressed we're gonna say UI except that's our spacebar by default if it is we're gonna do is we just need to reference our animation player and then we should do it thusly it's a dollar sign and animation player tada and then we click Play choose the one that we want to use on a hit spacebar I'm gonna do the yawn and we're done I'm also gonna put in the other one real quick which is basically all of this exactly the same with limited changes so instead of UI except I'll hit you I cancel it's my escape key and instead of big yawn I'll put evil laugh and now let's save this scene save scene and script save script now if I go over to my world scene and click on the world and I'm going to click the link and I'm gonna add my mimic t sen file and there it is now run this alright run let's see how that looks so hit space ha and if hit escape key ha ha so that runs exactly like it's supposed to I strongly recommend using the animation player for your animations because you can hand off that labor you don't have to figure out how to iterate everything in your process loop let let Godot do that just in here animation player go be free do do what I tell you to do again there are tools and Godot too you blend your animations so you can more smoothly blend from one animation to another one and it looks it looks really good but that's that's a video for another day well I hope you had fun hope you learned a few things today if you get a second and got nothing else to do for the next 12 seconds or so if you were to do me a solid and click the like and subscribe button that would be that would be epic I really thank you so much for those of you who've already liked and subscribed previous videos just that's just wonderful I really appreciate it I think in the next video we're gonna show you how to use both a shape key and an armature at the same time so say your character is walking and talking at the same time your talk you may want to use a shape key your walk you're going to be using armatures and for some of that's confusing like how do I get both of those things to happen at once hopefully have that video out next week and until then this is Brian Carey reminding you to be a scholar and a barbarian
Info
Channel: Savvy Barbarian
Views: 10,463
Rating: undefined out of 5
Keywords: Godot, godot engine, godot game engine, unreal, unreal engine, unity, unreal game engine, unity engine, Blender, blender guru, godot guru, foss, linux, debian, ubuntu, mint, indie games, indie game dev, indie dev, vs, godot vs unity, godot 3d tutorial, linux gamer, game dev, savvy, barbarian, savvy barbarian, intermediate, godot example, learn godot, learn blender, armatures, armature, blender armature, animation, export, animation tutorial, tutorial, blender tutorial
Id: lqEGJBpCFwA
Channel Id: undefined
Length: 19min 22sec (1162 seconds)
Published: Fri May 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.