#RiggingInMaya | Part 14 | Space Swapping

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the arms legs and torso are now rigged although we do still need to add in the roll and twist joint functionality plus some squash and stretch before we do that though i wanted to explore some space swapping options really quick question for you now how would you like to help support the future of this channel and keep these videos free well there are a few options one would be to simply treat me to a coffee at my coffee page as a quick and easy thank you you could also grab something from the ant cgi store or one of my other online stores like cubebrush and gumroad this is where you will also find the course files that go with this course so you can download them and follow along however for as little as 99p a month you could join the ant cgi club there are a few ways you can join you could head over to my patreon or coffee pages or or alternatively simply hit that join button below this video in short the more support i get the more time i can dedicate to creating more high quality content just for you to get more information on how you can help follow the link on the screen or in the description below okay now that's out of the way let's get on with the video now i know we have skimmed over this in previous videos but i wanted to dig a little deeper into them and explore how we add them in for multiple parents in this video i will focus on the elbow pull vector controls and also the ik hand controls but these options can be applied to anything really let's look at the elbow control first what we want to give the animator is the option for this control to stay in world space so basically as it is now or we want the option to also make it follow the arm ik control you will notice that i've added a follow attribute which we will be using to switch between the two states okay let's open the node editor let's bring in both controls so the elbow and arm controls let's hide the shape nodes too we don't need them at this point just move these over because we want to move between the two states we need a way to swap or blend between them and if you remember we can do this with a blend matrix node something that we've used a few times already press tab and create one and let's rename it to arm pv left space blend these names seem to get longer and longer i may have to revisit some of these let's hop over to the attribute editor and open these so up here under the input matrix tab we define the world space position of the elbow control so we essentially record where it is now down here we can use the add new item button to create new targets for it again we've touched upon this before first we need to store the elbow controls position so we need these values here let's copy this tab so we can reference it okay so we need the blend node over here and all we need to do is copy the values across so from here to here okay that's stored and it will act as the world space position now you're probably wondering why i didn't just connect the nodes and then disconnect them again now basically if you do this the values will appear and as soon as you disconnect them the values will disappear so this is why we have to manually copy them across let's add another item now here we go so we can now connect the arm ik control to this new section so the elbow control can move to it and follow as it moves so take world matrix 0 and connect it to the blend node's target target 0 target 0 target matrix attribute wow that is a mouthful now we want this to drive the elbow control so connect the blend matrix node's output matrix to the arm pv controls offset parent matrix attribute okay so we can see the control has now moved to the wrist let's open this back up and close this we can now use the envelope slider to blend between the two states so now the control is in world space so it doesn't follow the arm control just bring back the node editor if we set envelope to 1 the control moves back to the hand control and then it follows as it moves so this works but it's not ideal we would need the elbow control to stay where it is rather than move to the hand having it this close to the hand can cause the ik to flip so how do we keep it away from the hand but also still make it follow the hand well we need to use something that will act as an offset so let's just create a locator and let's rename it to arm left ik swap position or pause for sure add the elbow control to the selection and then go to modify match transformations match all transforms and move the locator to the control we're going to use this as a proxy for the arm ik control so the elbow control will blend to this instead so to make the locator follow the arm ak control we simply parent it to it if i move the arm control now the locator follows but maintains that offset what we need to do now is use the locator's position instead of the arm control so take its world matrix 0 attribute and connect that to the blend matrix node instead so it goes into target matrix here and that's set up now all we need to do now is make the follow attribute control the blending so take follow from the arm pv control or the elbow control as i've been calling it and connect that to the blend matrix node's envelope attribute so that's going to control this okay so the arm control is set to world which means i can move the arm control and the elbow control stays where it is if i change this to hand now the control moves but to the locator so it's maintaining the distance so we don't get any flipping issues with the ik this also means it will follow as the arm moves what makes this even better is the animator could place the locator wherever they like they could even animate it for even more flexibility so that's a basic two-way space swap so let's move on now and look at something with more options with the armpol vector control i'll use its correct name but you know what i mean if i refer to it as an elbow control we have just two options when it comes to space swapping so how do we approach the hand which has four well it's very similar to the elbow control but also a bit more complicated so i'll try my best to take it step by step but if you're not sure please feel free to look at the source files and pick apart the rig so you can see what's going on so let's jump back into the node editor so we have these options here which represent these controls the cog hips and arm root control so just as we did with the elbow we need a locator for each of these controls so we can maintain that offset duplicate the rmik space position locator and move it out of the hierarchy let's rename this to cog left swap pause now duplicate it twice and then rename these so hips and clavicle select those and then select the arm ik control now use the match transformations tool to move the locators to the arm ik controls position remember that the locators can be anywhere you like so if there is a better position you or the animator can move them later okay these are all in position now we need to parent the locators to the controls the hand will need to follow so the cog locator is parented to the cog control the hips locator is parented to the hips control and the clavicle locator is parented to the arm root control i'm referring to it as a clavicle because this will ultimately control the clavicle joint something we will cover later in the course i'll just show you these in the outline too there you go so these locators will move with the controls they're parented to there's the clavicle locator right let's start wiring these up create a new blend matrix node call it arm left space blend select the arm ik control and open the attribute editor so we need to store these values in the blend matrix node just as we did with the elbow control let's copy the tab select the blend matrix node and copy the values across to store them remember this will be the world space position okay now add three more items one for each of the locators we created now connect the locators to the blend matrix node so the cog locator world matrix 0 attribute goes into target 0 target matrix the hipsworld matrix attribute connects to the target 1 target matrix and finally the clavicle world matrix attribute connects to target 2 target matrix ok those locator positions are now in the blend matrix node so we can then use that to switch between them right let's make some room unlike the previous blend matrix node we can't rely on the envelope attribute to dictate where the rmik control goes all this will do is gradually blend between each of the locators whereas we want a distinct snap to each so what we need is basically a switch of sorts create a new node but this time create a condition node and let's call this arm left space condition so what condition node does is checks two values and compares them depending on the outcome a different value is then output from the node so the first term here is compared against the second term value we have an operation which we can change depending on what we are checking so by default it will see if both values are equal but you can check if the second term is greater than the first term less than the first term and there are many other options you can look at let's leave it as equal for now so when the first term is equal to the second term the node will output values from the color if true row here if they aren't equal it outputs the color a false value instead so it's quite a powerful node and one i use all the time let's wire this up so you can see how it can be used open it up first so these are the output values and they represent each column here r g and b as mentioned earlier we won't be using the envelope slider this time instead we will be using each target's weight attribute let's open this so we can see them we have three columns coming from the condition node and three targets to control so we can do this with the condition node connect out color r to target zero's weight value out color g connects to target one's weight attribute and finally out color b connects to target one's weight attribute so we will be using the condition node to switch the weight values on and off which will change what the hand control follows speaking of which let's bring that in now and move it up here so what we are interested in is the follow attribute here which has the four options in it connect that to first term if we look at that now you see first term is set to zero which represents the world option drop down boxes or enums like this always output numbers so world is equal to zero we can use this first condition node to check if the follow attribute is set to anything other than world or zero it will then use the attributes below okay so we now need some more condition nodes one for each locator just close this and let's duplicate this one three times and let's rename these so they have the correct control in the name so with these three we will be using them to check if the follow attribute is set to that controls number and if it is pass that on to the master condition node this will then switch the correct weight value on and off first we need our follow attribute again so connect that to each of the condition node's first term attributes with the cog condition node we want to check if the first term changes and if it does has it changed to the cog option if i change the follow attribute now to cog and look back at the condition node you will see the first term is now one so we need to set second term to one as well so when these are equal it will tell the main condition node we want to follow the cog control and then that will activate the cog section's weight let's look at the hip condition node and change follow to hips first term is now set to 2 so we need to set second term to match this so it triggers when the animator wants the hand to follow the hips okay let's change follow to clavicle now so first term is now three so add that into the clavicle condition node's second term box because this is a simple setup we only need to worry about the first r column here so we just need out color r from each condition node let's open these first so we need the color if true options here from the cog condition node connect out color r to color if true r on the arm space condition node next connect the hips condition node's out color r attribute to color if true g and then the clavicle condition nodes out color r attribute to color if true b so when one of these condition nodes matches the follow option it will tell the main condition node and that will then update the blend matrix node's weight values you can see the boxes here are now yellow which means they are connected to something what we need to do now is change all the color if false attributes to zero so if the follow option isn't one of these it will simply set the weight attributes to zero with this first node we also want to change the operation to greater than so we are saying if follow is set to an option that is greater than world then return a true value below if i set follower back to world first term is now zero so the condition node will be outputting the false attributes below this will set all the weight values to zero meaning the hand control stays in world space and doesn't follow any of the locators let's set it to cog now and check it hmm okay this doesn't look right we should only be getting one value below set to one let me check the other condition nodes all right the true value should be one and false should be zero so let's just update those that's better just the one now so because the first term is now greater than the second term this is the value that will be sent to the weight attribute and each of these will change depending on what the follow attribute is set to so you see the first is now set to 1 and the others are set to zero so we're deactivated let's change to hips now and the first term is now set to two and below the one has moved to the second column or the g column so let's test this on the control ah okay it would help if we actually connected the blend matrix node to the arm ik control okay move this over and connect output matrix to the arm ik controls offset parent matrix attribute well it's moved so that's a good sign let's close this so the arm should now follow the cog control it does great let's swap to hips now and it follows the hip control let's move the root control now which as mentioned will eventually control the clavicle too and switch follower to clavicle the hand now follows this control and world just leaves it floating in world space so we do have all these locators now but as mentioned earlier the animator can use these to control the hand's placement so it could be sat on the creature's hips for example as the hips are moving okay let's reset some of these time to do some cleaning we want the locators attributes to be set to zero making them easier to use and animate and also get back to the default pose again we can simply move the values down to the transform offset parent matrix section and that can now be moved and animated and easily reset to zero to get back to the default position let's do the same on the other locators now and clean those okay good so that's space swapping set up on an object with two targets and also one with multiple targets and as mentioned at the beginning of the video this can be applied to anything really if you wanted you could go back and rework the head removing the constraints we added and swapping them for this more economical solution what i would also suggest is maybe adding a new attribute here one which will control if the locators are visible or not this will just declutter the scene when the animator doesn't need them simply connect the new attribute to the visibility attributes here okay so now i need to go through all that again and update the right arm and i can also do the same process with the legs so i will do that and it will be back in a few seconds yep i'm a fast worker okay here we go all the space swapping setup and feel free to pick this file apart if you're at all unsure with any part of the process as you can see i also added the attribute i mentioned too so we can hide those locators so that's space swapping covered i think next we will go back to the limbs and investigate adding the roll and twist joint systems okay that's another video over thanks for watching right to the end and make sure you also check out some of the other free videos and courses that i have available you can find links to all these on the screen now and in the description below remember to help support future content and keep these videos free visit the ant cgi store or join the ant cgi club alternatively if you would just like to show your appreciation for these videos why not treat me to a coffee at my coffee page again the link is on the screen now and in the description below thanks again for watching this is ant cgi signing off and i will see you on the next one you
Info
Channel: antCGi
Views: 496
Rating: undefined out of 5
Keywords: rigging, maya, autodesk, maya3d, rigging in maya, utility nodes, rig, node editor, nodes, Build Controls, 2019, Spine, Head, Pelvis, Waist, Abdomen, Sternum, Shoulders, gamedev, game art, game development, game rig, 2022, maya 2022, offsetParentMatrix, blend matrix, condition, node, space swapping, space, world, local, cog
Id: BFCggv0SV0s
Channel Id: undefined
Length: 23min 49sec (1429 seconds)
Published: Thu Dec 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.