How to - Rigging Hands with Unreal Engine's Control Rig

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
a while ago I made a tutorial about the basics of using a control rig in unreal to set up a ik movement rig in that video we kind of passed over rigging up the hands because I wanted to make a separate video on that and that's what we're doing here today so I'm making a simple rig here which can open and close the hands or even move individual fingers now as you can see in my case the weight painting here is a little bit messy so the deformation is great for this particular model you don't see those fingers moving up close that much so it doesn't matter as much I can love with it you probably want a little bit better weight painting on your model if you're going to do this so let's get into it so back in our project here where we left of last time the project files are down below in the description for YouTube members and patreons to download let's open up our control rig and in our sequence here we first make our FK chain for the spine and then the ik for the two legs here next up let's make another pin to the sequence we could also collapse these into functions if we wanted to and here we're going to set up the movement for the fingers but first we need the controllers for the fingers and of course you need to have a skeleton with bones in the fingers I assume that goes without saying for this I don't have the arm ik set up otherwise you would parent the control for the fingers to the control for the hand of course because you want the fingers to move with the hand so for now we're going to just put them somewhere random I'm going to make a new uh null here though just for grouping purposes and I'm going to call this one uh hand and since we're looking at the right one let's actually make that uh hand R here we're simply going to uh pick the top bone of every single one of these fingers you don't need to select the bottom ones and then we're going to Simply add controls for selected which will add a controller for every one of those bones and we'll parent those under our new hand R null let's select all of those and change the shape into an arrow because we're going to be moving these just one way up and down and an arrow makes the most sense for that you can use any shape you want you can just use spheres if you prefer we're going to go for the arrow solids and you'll see they are a little bit all over the place and a little bit too big so let's first and foremost make them a bunch smaller maybe even smaller than that now that they're all nice and small what we're going to do here is I want to change this to World space and I'm just going to increase the height so that they're above the fingers this is just for a little bit of ease of use then we'll right click all of the selected controllers here and we're going to uh set offset transform from current if we don't do that and we compile uh they will reset back to their original position but now this is their position you can just keep the arrows like this if you want to I prefer to rotate them around so they are facing up and really honestly the easiest way to do this is just to Simply one by one rotate them into the position that you want and then again you select all the controllers and you uh set offset transform from currant to save that as their default position now with these animation controls selected we're going to go over here to the right hand side and uh let's expand this a little bit and the value type is set to UL transform at the moment and that's not what we want because we simply want a float value out of these so we can set these to a float value instead which will give them these weird lines uh which go all over the place you can see which one lines up most with what you want for me that will be uh the Y and doing that creates these lines which seem to be going entirely the wrong direction so the easiest way to fix that which isn't great is to go back set it back to U transform and simply rotate these 180° in the other direction and then in the shape transform here in the Rotator just rotate this shape 180° this way the controller is facing the right way corresponding to the shape and of course once you've changed all of those set offset transform from current and then we can set them all back to being floats and suddenly the lines are going in the the right direction but they are still way way too long and that's what we get into this value we have our initial our current our minimum value and our maximum value our maximum value is set to 100 and that corresponds to how long these lines should be so let's set our maximum value to something like 20 instead you might have to play around a little bit with the length here because I set it to 20 and that was very much too long even though in my own project with this same model 20 was proper so let's just set it to one for now maybe even 0.5 whatever you set this to it doesn't actually impact the calculation here what we're going to be using is a percentage of how far along these arrows are and let's actually get into that right now for let's start with uh the pinky finger over here with this control for that we're going to make an array of the bones that it should draw drive so let's open up our bone hierarchy here and find our right hand uh the two pinky fingers we can just drag that into our graph here and we can create an item array off of that and let's pull that all the way down here and now that we have an array of Bones we can distribute rotation along those so we're going to do that with our sequence node here we're going to hook that up and here in the rotations we're going to be adding a new item and there we want to put in a rotation value the rotation value here we're going to get from a uler or Oiler whatever you want to pronounce it as aquatan and here you want to just mess about a little with these values depending on how your bones are set up for my example I have this set to 30 but as you can see that does weird stuff uh so maybe we need to have the Y AIS be at 30 or the Z axis the z-axis does seem to be doing its thing uh but apparently I'm using a different skeleton for this model here uh let's say minus 30 and now you can see both of the segments of the finger are both being rotated now well that's fantastic but how do we actually hook up this controller to it well that's fairly easy as well we just take in the pinky controller we get it and we do a little bit of math because we take the float value here and then we simply divide that by the maximum to get a percentage and this will just be the percentage of how far along this controller is on its little line here and that will go into the weight of the distribute rotation meaning that if this controller is now up at the top we are not rotated at all but if I take this and I pull it down we can see the finger rotating and here we can start messing about with actually maybe we want to rotate this a little bit more so set it to minus 50 at the most and we can do this over and over again for all of the fingers in the hand now if you need to do this for every single finger in your hand you're going to end up with this times 5 which is fine honestly but there's a slightly easier way to go about doing this and that is to instead of hooking these things up directly taking a array here and putting in a for each Loop I'm going to disconnect the array because that's not the array that we're going to be using the way we're going to have this work is we're going to make an array of all of the top finger bones so we want to get our pinky our ring finger our middle finger I like having the thumb not included in this actually because it usually wants to rotate a little bit differently from the rest I'm going to include it now just to see how it works and the index finger all of the top bones not the bottom ones if you have more than two bones in your fingers by the way this all works more or less the same way so we'll create an item array out of those five fingers and there we will simply get the children from each of those Elements which then again outputs an array and we can use that array in our distribute rotation instead now if we expand the elements here we get the type and the name of that element as well and this is something that we want to make sure is done properly because we're going to be messing with names now and these need to match exactly so we take the name of whatever element we put in here which is the name of the corresponding bone and then we concatenate which just means adding something at the end of it uncore Ctrl for control because that's what automatically is added at that's the end here so you want to have your controls be exact matches for the name of the bone with Ctrl after it because if we have a name we can then use the get control float node which just goes through all of your controllers and sees is there any controller with this specific name if so we're going to use that as the controller here and that way we don't have to get like a specific reference to a specific specific controller so just as we did before we're going to Def fight the float by the maximum for the weight here and we get a warning that just warns us about things being added in local space which is exactly what we want and in the get children node we want to include the parent in that and we might as well include recursive as well which just adds in literally everything under this bone in the hierarchy so let's compile that and and see if our fingers all work they do seem to all work without having to set up five separate lines of nodes here and let's see this one works as well let's see what the thumb does because the thumb as I said before can be a little bit weird and as you can see uh the thumb is doing some slightly weird stuff so let's take the thumb and remove it from this array because we don't want that thumb we're going to after this array is complete just copy this setup more or less and just do the thumb manually just because it needs to rotate in a slightly different way from the rest of the fingers the rest of the fingers just need to curl around the thumb also needs to move inwards so for this one we'll just get a reference to the thumb control directly not with getting this through a name or anything because that can only end up badly if we don't need it and our item array is going to be the two thumb bones and for this you really just wants to uh move about a little and see what works that is uh the wrong direction so we want to move it like that but a little bit less than that so something maybe somewhat like that probably also want to rotate it less in the Z and maybe rotate a little bit in the X and honestly this is just a matter of experimentation a little bit but again the thumb probably should be rotated on its own and not as part of that Loop so now if we move all of these controllers all at the same time we can see we can kind of make a position that can hold a sword for us of course if you make these numbers larger and your weight painting and your geometry actually supports it you can make it all the way close into a fist if you would like to this is just the basic ideas of rigging up some fingers for your hand so I hope this was helpful if you want the project file with this entire rig it also includes the ik for the legs which we did in a different video it will be down below in the description in a link to either the patreon or a members only YouTube post so if you become a member on YouTube or a patreon you can download the project files and play around with this as much as you would like with the skeletal mesh asset here that I've been using for an example included and a very big thank you to all of my bans you can see them on screen right now if you want to help out to booring the channel there's a link Down Below in the description to the patreon page and a special thanks to my cave Digger tier patreons Serge Thomas
Info
Channel: The Game Dev Cave
Views: 4,405
Rating: undefined out of 5
Keywords: unreal engine, control rig, unreal control rig, unreal engine control rig, unreal animation, unreal engine animation, unreal IK, unreal engine IK, IK, gamedev, the gamedevcave, game engine, epic games, hand rig, hand rigging, finger rig, finger rigging
Id: mvm5J4O9pl0
Channel Id: undefined
Length: 13min 39sec (819 seconds)
Published: Wed Nov 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.