UE4 Control Rig Hand IK

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to another video and today we're going to do ik hand thingies so basically if we run into the wall the character is going to put his hands up in front of him and also if he's going to run by the wall a little bit slightly angled towards it he's going to put his hand out and then we can do some cool tricks like this one like hey neighbor what's behind the corner hello let's get started [Music] so let's head in back into our control rig i'm gonna be doing this a little bit quicker because basically what we are going to be doing is already what we have done in the past except for this time we are going to adjust this for our hands so therefore using different bones and new controls basically but the logic stays the same so we need two controls so i'm going to add my controls to the ik root so i'm going to go right click the ik root go to the new create a new control you can see it goes up don't worry about it it follows the route inside of the preview in the actual level it doesn't do that and we're about to attach it to our hands so it's going to be fine so let's do ik hand underscore l and we're going to right click again create another control under the ik root and we're going to call this ik hand underscore r let's go ahead and let's snap these to the hands so what we're going to do is we're going to go ahead and set the controls up here at the bottom at the top where we already set our foot and the body control we're gonna do this for both of our hands so we're gonna set both of those controls up here and we're gonna grab the bones that need it needs to be where the controls need to be attached to and those are our hand a bone so we have our hand left hand right so we're going to get the transform of that and also the hand left so we're going to get a transform of that we're gonna plug in the transforms transform number one and the transform number two and as soon as you we do that you can see now that the controls have been attached to the wrists of our character and that's where those hand bones are located in okay the next thing is we're going to need a bunch of variables so let's go ahead let's start adding all of them at the same time pretty much all the variables are going to be again the same so we're going to have our hit hand underscore l which is a boolean we're gonna need another one for our right hand then we're gonna have another variable which is gonna be our hand location underscore l which is going to be a vector this time we're not going to use a float value we're going to use all of the axes and then we're going to have another one for the right hand then we're going to have a hand normal underscore l for the slope of the surface we're gonna have a one for the right hand as well and then we're gonna have a current offset hand underscore l so that we can move the hands slowly over time rather than snapping them and same again for the right hand as well so we have eight new variables four for each hand and what we need to do now is actually go ahead and set those so we have our hand left we're gonna set the hit we're gonna set the location we're gonna set the normal and the offset is gonna be set somewhere else so we're gonna set these three up and then we're going to do the same for the right hand as well so we have our hit we have our location and we have our normal not yet i meant to set okay so we're going to be setting these up and we're going to be setting these up again by using a sphere trace like so and just connect all three of them so we have our hit we have our location and we have our normal and the same thing for the bottom as well we have our hit location and normal okay so far so good now we need start and end positions for these and before i do that i'm actually going to connect the execution to the sequence so c route for the left hand and then we're going to have a d route for the right hand there we go that's our execution done now we need start and end positions now for these positions i'm going to be using something different previously we used the bone the control rather this time we're going to be using a bone because our controls while running the characters arms are going to move back and forward so we're going to get inconsistencies when it comes to distances but the shoulders are roughly going to stay in the same area and that's going to be a good location at least in my opinion that's a good location from where to do a sphere trace forward so we're going to grab our upper arm bones so upper arm left we're going to get the translation of this all we need is the location of this with no don't want to set it i actually want to yeah we can't get the translation so we're gonna need to get the transform rather and then split it yeah so that's what we're gonna have to do and then for the upper arm again we're gonna get the transform splitted okay so we have the location so the location can be the start position that's completely fine but the ending position we want to shoot it forward so what i'm going to do is actually i'm going to do a add i'm going to add vector plus vector and that's going to be the end position and what i noticed that the best results come from a value of 60 in the y y is going to be r forward that's interesting that it did that okay once we compile it it went back to normal okay that's good so uh i found out that 60 is the best value and i can see that the y-axis is the forward axis for my character so therefore i know i need to use the y-axis for you it might be different based on how your skeleton is built but yeah this is these are the axis that i'm having to use and you can look at the this tool right here that shows you the directions of the axis okay so we have the traces all set up and ready to go now we need to go ahead and set the offsets in a way i'm saying in a way because we're not going to set offsets what we are actually going to be doing we're going to set the translation we're going to be setting the location rather than offsetting something so we're going to grab our hands and we're going to go ahead and set the translation for them so we have the left hand and we have the right hand and both of those are controls not the actual bones and then let's go ahead again let's use our execution routes to plug them in and the other one to the d route there we go all good over here now just like previously we're going to use the accumulated lerp and we're going to store the current offset in the memory so we're going to go ahead and set those values up we're going to set the current left hand offset over here we're going gonna set the current right side hand offset over here now for the values themselves um actually i should do a branch so it doesn't try to offset it if we didn't hit anything so before we do that i'm going to do a branch i'm going to run a branch through here and only on the true route we're going to proceed with the code and the condition is going to be our hand hit variable because if we don't hit anything we don't want to change the translations otherwise the character is going to try always face toward the last wall it has hit so that's a big no-no so we want to do another branch over here run it through the true route and then go ahead and use the hit r like so now for the location itself we're going to grab the hand location l so where we hit the wall and from here we're going to do a accumulated lerp vector so it happens so the movement of the hands happen over time and that can be our translation now for the initial value just like previously we're going to grab our set current offset hand l that's going to be our initial position we're going to apply a blend time of like 10 and enable delta seconds and then make sure that you grab the result and also set it so that it does get stored in the current offset and the same logic over here so i'm just going to duplicate the node plug that in set it and then we're going to grab our current location right and we're going to grab our current offset right plug those in there we go so that's good on that part so that's for the positioning now we also need to go ahead and rotate them based on the surface so what i'm actually going to do is i'm going to add another sequence inside of here and i will reconnect these guys that i have over here so they're going to go into the a and b routes and then this a route is going to initiate the sequence so that i can have for aim at math available in this single sequence so two for the legs and two for the arms okay so what we want to do over here again is apply a rotation on our controls so we're going to grab our hand controls we're gonna set rotation and we're gonna do the same thing for the other one we're gonna go ahead and set the rotation like so now before we actually do this we should go ahead and make sure that we check if we have actually hit something so i'm going to do a branch and then only from the true route again we're going to execute the rotation and then execution can go in the sequence we're gonna need another branch true route goes into the rotation and then this is the d route okay so i'm gonna bring it down so that i have some space for the aim math node so i'm going to do aim math we're going to go ahead and split that to get the rotation plug that in all good with that one now with these values so again we're going to have our hand normal l so i'm going to grab the hand normal l and plug that into the target of the primary axis of the primary and for the x's i'm going to be using the minus 1 on the y axis or wait this is the left hand so this one was positive 1 for my skeleton this is so this is going to be 1 because we're going to go forward in the y axis usually well hopefully uh it totally depends on on the skeleton again because yours might be rigged a little bit differently then you might have to again experiment with these values i had to do quite a few experiments to make my numbers work but these are the numbers that do work with the default character okay and then for the secondary again i'm gonna kind of in a way hard code these in so it's gonna be minus one on the z uh or again this is the l so this is gonna be positive one in the z and positive one in the x so those values stay by default the way they are and then i'm just gonna duplicate this node and i'm gonna just gonna flip the values around again so since this was one now it's minus one z minus one and the x is minus one as well for the target we're going to use our normal from the right hand and the condition is our hit right hand like so okay so that's that so maybe pause the video if you need the values just going over them and also make sure we do apply the boolean condition over here as well and make sure you're using the correct variables so that they are left for the left control and the right ones for the right control that's very important so our maths are all ready to go the last step is the full body ik so that if our character leans forward to touch the wall so that his spine would lean a little bit as well so we're gonna add two more effectors to the full body ik we're gonna go ahead and open those up so the effectors are going to be our hand left bones and the hand right bones so you will see the character doing this because we didn't provide any values so it will go both of the wrists will go to the zero position of the character so this is what it should like at this point and once we go ahead and grab our controls so we're gonna get the control split it and then populate the rotation and the position you can see one of the ends went back up then we do the same thing for the other one and you will see that both of them go up back to default there we go so we are pretty much done with the hand and leg eye case so now if we run around we're all good if we run into the wall boom our characters puts his hands up in front bends a little bit backwards because the hands are pushing him away but i'm noticing that the hands are a little bit inside of the wall again so if i run by the wall he should grab it so this looks pretty cool he's like hey what's behind the corner hello my friend okay but the hands are a little bit inside of the walls so what i'm going to do is the same trick i did over here for the for the legs i made them go a little bit higher this time i'm going to make sure that they go a little bit backwards so hit location i'm going to do a sub subtract vector and that's going to go into the location and i'm going to subtract let's say 5 in the y axis so it would go a little bit backwards so i'm going to do the same for both subtract 5 from the y-axis from the traces of the arms and now hopefully the result should be a little bit better maybe it could go back a little more but it does seem to be pretty pretty decent enough so again you can go ahead and experiment with these numbers obviously the the trace length depends on how close you want your character to be running to reach out to the walls because if you would grab your trace and let's say instead of 60 you do let's say like let's do on one hand let's do 160 you will see that the character starts putting his hand up way sooner but then this thing can happen because he's trying to lean forward and he's gonna bend his whole body in order to move forward and as once we get closer you can see he bends a little bit better differently so he brings himself up a bit but he's trying to reach the wall even though he can't really do that yet so you can go ahead and experiment with these values so let's say if we do like 90 should be maybe a bit better there we go so that's a little bit better so it could go maybe from 90 but i i i prefer mine to be at 60. so yeah that's going to be it for this video this one is was a bit quicker and didn't really explain that much but i feel like i explained these logics already previously and i didn't want to drag this out into another two three episodes of videos and just put this all in in the same video so if you have any questions feel free to leave them down in the description box also feel free to re-watch the previous videos where i explained what what we did over here a little bit more in depth because we basically we basically did what we already did in the previous episode so thank you for watching make sure to subscribe if you haven't already and i see you in the next one so you
Info
Channel: It's Me Bro
Views: 9,841
Rating: undefined out of 5
Keywords: ue4, ik, hand, foot, placement, control, rig, unreal, engine, tutorial, guide, easy, setup, animation, full, body, aim, math, fullbody, aimmath, basic, dummy, controlrig
Id: 25xNH-PpA8E
Channel Id: undefined
Length: 16min 54sec (1014 seconds)
Published: Mon May 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.