#RiggingInMaya | Part 2 | Fundamentals | Connections & Constraints

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Not my video.

Just another one of antCGI's that has helped me understand some aspects that I'd not seen gone over in this amount of depth in other tutorials.

👍︎︎ 1 👤︎︎ u/blueSGL 📅︎︎ Jun 14 2019 🗫︎ replies
Captions
hello and welcome to the second video in my rigging Amaya series previously we looked at joint creation as well as some of the key elements and attributes you will need to be aware of when building your skeletons the natural step to follow on from this would be to begin looking into controlling those joints ideally with any rig you don't want the animator to be able to directly select the joints they should be hidden away and instead controlled with custom icons or other attributes we will be discussing how to create custom control icons in the next video but those controls need to be able to drive the joints so in this video we will be talking about the various connections and constraints you can use to achieve this so let's first look at connections in Maher you have the ability to connect one attribute to another or one attribute to many others so a single value can drive a whole host of others in the scene to demonstrate this I'm just going to create a joint and a very basic control icon so if you remember from the previous video I'm just gonna go use the rigging shelf tab and I'm just going to use the create joint tool hold down X and I'm just going to create one in the center of the grid so that we just have a basic joint I'm not going to play around with any of the attributes or the rotation orders or anything like that now for my control I'm going to create a create NURBS primitive circle like so and I'm going to move that up just so that we can see it clearly so we have a basic control now and I'm just going to adjust this display drawing overrides enable of right and then I'm just gonna change the color to not green yellow so that just makes it stand and out a bit more and like I said earlier we're gonna look into creating your own custom controls in the next video so here we have a control and we have the joint and as mentioned before ideally we want to be able to hide the joint so all we're going to do is the anime is just going to animate with this they're not physically going to move the joint around now the reason we don't want them to edit the joint if I move the joint up slightly let's move the control up now the problem we have now is the joint has this y value on it whereas the control now that has a y value on it as well but what we can do with the control is we can go to freeze transformations up here it can freeze that and that resets all these and zeroes them out just going to delete the history as well and that just leaves it nice and cleaned and that gives you a nice level of control to use with NASA zero values now the problem with the joints is we can reset we can freeze the transformations but it doesn't work on the translate values so if you are an animator for example if you're just using the joints directly if you want to zero out the rig obviously if you zero this out now it's going to reset all the joints back to you know the route this is why we use controls because controls can be separate and there's lots of other things that you can do with controls as well that you can't do directly with joints so as a basic rule you should always use controls to drive joints and not use joints directly anyway let's get back to connections so just to demonstrate this I'm just going to zero this back out and you'll see why in a minute so when it comes to connections all they are is you are directly connecting one attribute to another and there are a couple of ways that you can achieve this we can go to window general editors and go down to connection editor down here this opens up this new window and all we do is we select the control and reload left and we select what we want to connect to and we reload right and we can open these attributes here basically you can connect all the rotations directly like so and you can see in the channel box they've turned yellow to indicate that the joint is connected to something else now what that means is those rotations are locked so you cannot rotate the joint instead they're being controlled by the controller as you can see as I rotate this around the joint is rotating too and that works quite nicely a direct connection there's no extra nodes involved you don't have to use set driven keys which again add extra animation curves on top of that you've got direct connection between one attribute and another or in this case rotate X Y Z and rotate X Y Zed you can connect them individually so if I break that connection there so we only want rotate X so now if I rotate Y nothing happens or Zed if I rotate X the joint rotates too and you can again you can see in the channel box is highlighted in yellow so that's one way that you can connect those attributes and again in here all this is showing are the very basic attributes that we can see here if we wanted to we could show the hidden attributes sure the attributes are connected only and that's just telling me that rotate X is the only one connected so it's just showing me here and shown on cable and that just brings up all of these pretty much every attribute associated with that joint now it says it's not the non cable but you can still connect other attributes to them if I data like that if I select something else let's select translate X you'll notice that these these are grayed out I mean that you cannot connect that to them but the ones that are in white and bold now mean that you can connect them I select the rotate which does obviously the three attributes at once now a lot of these are grayed out so that's just a very basic overview of using the connection editor just to connect one attribute to another now to go a step further you could have your own custom attributes which are added to a control and again we're going to cover this in the next video but then those custom attributes that you are help on here could then control something else associated with the joint perhaps it's the radius perhaps it's the visibility you know the possibilities are endless but that's just how you can use direct connections so what I'm gonna do is I'm just gonna disconnect let's turn that off so that's freed up there we go so the other way that you can connect one attribute to another is to use the node editor and I'm just going to find that now window node editor here so if we open this up so I'm going to select the control and I'm going to select the joint and then I'm going to click this button here which is yours gonna add those selected nodes to the graph now we don't need this shared node so I'm just going to click this button next to it which will remove that and that means we can just focus on the nodes that we want so we have the joint over here and we know that we want the NURBS circle one node here which obviously should have a better name to drive the joint so I'm just gonna open those up and as you can see we can see all the attributes here you know everything that we want to work with so it's pretty much it's very similar to the connection editor but I think the node editor is just a lot more user friendly and I tend to use this a lot more but just as we did with the rotation before we could just select rotate here and drag across and connect to rotate there and that's just on the same thing you see up here we've connected that rotation you can also select that and delete it and we could just rotate X could go to Row 2 X there and I mean you could do this with the connection editor as well but you could say root X needs to control royalty is that y - x z - nothing connected it that would go up right to X you know and just play around a lot with that so that the rotations are affecting different axes and that's useful if as we discussed in the previous video if you have to change your rotational axes you know so maybe Y is pointing down the bone you may need to have the Y rotation on your icon controlling a different rotation on your joint because the orientation is different so that just gives you a bit more flexibility when it comes to building your controls and working out what controls what so the problem with connections is the values that are on the control will be applied to what you're connecting - absolutely exactly 1 for 1 so if I let's connect the translations so this is fine because because the jot the joint is at 0 0 0 anyway I was adding a connection from this control which is 0 0 0 means it doesn't need to move and we can move this around and the joint followers happily so if we break that connection now what if we have what if our joint is up here somewhere you know and it's part of an arm or something put the control up here I'm just going to hold down V which will snap it to the middle of the joint and move it above there and then I'm going to freeze the transforms on that control and as discussed earlier we can't freeze the transforms on these translation values on the actual joints itself so what happens now is if we connect the translate from the circle to the translate on the joint it's going to snap back to the root because the control is zero zero zero its snapping the joint back to zero zero zero and that's we're using direct connections can fail really the values are exact now there are ways around this you can use utility nodes which again I'm going to cover into a future video but you could put put a utility node in between these connections here and then create an offset so let's just put that joint back like so so what you would do is you would put a utility node in between these so this translation value here would have these values added to it on the utility node in the middle here and then it gets four girls from the utility node in the translation so you get an offset that way so that's one way around it but the other way that you can connect your control and your joint and maintain a good offset is to use constraints and that's what we're going to look at next so now we've looked at the benefits and also the limitations of using direct connections let's move on and have a quick look at constraints and constraints are very very useful and very powerful nodes in Maya I use them all the time in my rigs I don't think I could do them without them well that's not entirely true there are ways that you can get around not using constraints but things just get complicated then so constraints are hidden in the if you you need to go into the rigging menu set and then you've got a constraint menu appear so as you can see we've got lots available and we're just going to look at these main few appear so the parents point orient scale and aim the pole vector constraint we're going to leave that and we're going to look at it in a future video when we start to look at I K and FK so essentially these will constrain the movement of the joint to the control but in different ways so let's have a look at the first one parent so the way you use it is you select the control first you select the joint that you want to can be constrained second and then let's just open up the options reset the settings so as you can see here before we apply this we've got lots of options available to us now maintain offset that will just mean that the control the joint sorry will stay where it is rather than being snapped to the actual control itself so if I click apply now we can see down here that the the joint now has these blue icons on here which indicate that this is being controlled via a constraint and because we had maintained offsets enabled the joint stayed where it was so if I undo that and turn off maintain offset click apply see the joint then snaps to where the control is now most of the time you'll probably use maintain offset because you want to believe your joints where they are another option available to you if you didn't want to have maintain offset on it works on the pivot point for that control so if I held down insert then hold down V and with the middle mouse button just snap this to the center of the joint now without maintain offset switched on if I click apply you see the joint then doesn't snap to the control and we can rotate that joint we can translate that joint and that's pretty much what this constraint does it allows you to control the joints using the translation and rotations of the control so let's just undo those like so now you do have the option as you can see here is to just constrain via all the translation values or you can just do all the rotation values or you can actually specify which axis you want to be constrained so it's quite you know flexible and you can change this according to how you want the joint to be controlled now I'm demonstrating this a control controlling a joint but obviously a constrain could be anything you could constrain a control to a control or a control to a group or anything really so that's the parent constraint let's just apply that there now again previously when I applied it without maintaining offset on I move the pivot point to where the joint was which meant that the joint the controls rotations and translations were pivoted around the actual joint but because the pivot point for this control is up here when I rotate this you'll see we've have an offset so it's pivoting around the actual control instead the same with translations so another way to think about the parent constraint is basically if I undo this it's going to our outline outliner if I pair in that joint to the control it's pretty much just doing the same thing the reason that we use constraints is because in your rigs you do want your joints or your skeleton hierarchy to be outside of your control hierarchy you don't want to end up with a hierarchy full of controls that have joints nestled underneath them especially if you're working on a game rig you want your skeleton to be as clean as possible so that when animation is done and you're exporting that to a game engine you don't have extra nodes in your hierarchy because this can cause problems so the solution is to use constraints so if you are wanting to parent one thing to another use a parent constraint instead rather than parenting it beneath the control so let's apply that again so that's the parent constraint so the next one is the point constraint and all this does if we apply that this just constrains the translations as you can see in the channel box so we can rotate that and it's not having any effect that is just going to grow that is just going to manipulate the translations so if I delete that constraint there let's a try and apply a parent constraint just with the translations so you see we get a very similar results but the problem is well it's not a problem really if we're using a point constraint the translations are affected but when you rotate it nothing happens to the joint when you're using a parent constraint instead but just using the translations you can move it around but then when you rotate as you can see we have an offset because it's still moving around the pivot of the control so that's the problem you know if you decide oh well I just why don't we just use a parent constraint and user translations instead it's acting as if the you know it's still parented to the control but the rotations are being ignored so you will still get this offset as the control rotates now in some instances that may be perfectly ideal for what you want to do but in other situations it may be that you know the point constraint is better because you want that complete freedom to then do whatever you want with the rotations unless 0 that so I'm just going to delete that node again so next we have the Orient constraint and that is just the opposite to what the point constraint does I used maintain offset again although we don't really need to because the rotation value is on the controller 0 and the rotation values on the joint is 0 so we didn't need to use maintain offset if I click apply as you can see it's just affecting the rotation and if we can move the control around it's not going to have effect because obviously the translations aren't being affected so again if we go back to the parent constraint and instead we just apply the rotations so if I rotate this and then try to move the translations so there's not much difference between the Orient and just using the translate rotation so it's worth playing around with these just to get a good idea and a good sense of what you need from that controlled so finally we have the scale constraint and that is simply it's pretty much the same again you've got to maintain offset value click apply and we won't see it here because obviously the joint doesn't scale just the offset does but then you know we've got to come straight there we can see it in blue so we could scale this icon and the influence that the joint has on the mesh will scale as well so you can also use that and that's quite handy if you are setting up sort of stretchy limbs or or squash and stretch and things like that so those are these four main constraints here and as I said before there's a lot more you can do with these now with connections you have one direct connection and that's it unless you start adding in different utility nodes you know things can get complicated then you're basically looking at a direct connection now the beauty of let's just get rid of these the beauty of constraints is you can apply more than one constraint so let's for example say we have this joint and I want it to either follow this joint or this joint so you can see this is where your eye kfk blending can come into effect you have your main skeleton and it can either follow the eye care skeleton or the FK skeleton so what we do is we select the two joints first that we want Amir joint to be constrained to so the last joint will be the joint that has the constraints applied to it if I click parent now what we can see is it's gone blue because the parent constraint has been added but down here we have joint three and joint one and these are weight values so that's two are joint three and that's joint one so it's just users names and next to those you can see we have a value of one so if I set this if I slide this one actually down I know I've done right so the issue I had there is because I had maintained offset on which we don't want in this instance because we want this joint to either snap to this one or to this one so we don't want it to keep an offset so let's try that again maintain offset is turned off click Add now we saw that joint move slightly because what's happened is it's moved so it's directly in between these two joints if I move this on down I'll move this one around you can see that our main joint is equally in between joint wand and joint three so going back to what I was trying to show you before we have these two values here which are a value of one and that is making this joint steer in between both of them if I set joint three down to zero you can see our main joint moves over to that one so we set that back to one and the same with if we set joint one down to zero it's going to move over to this joint so we can use these attributes to control where our main joint is going and obviously we've only used it with two joints you could use it with three or four or met are as many as you need it to but for this instance and the example I used earlier this could be the IKr this could be the FK arm and this could be the arm that's bound to the skin so you can use that parent constraint to blend this joint between those two and obviously you would have a an attribute on this control here so this FK I care blend to say just a basic name and that attribute will then control both of these attributes here and like I say we would probably use a utility node to do that or you could use a set driven key but I'll go over the process of doing that in a future video so those are the four main constraints what I want to do in the next part of this video is investigate the aim constraint and I'm sure you've seen this a million times but the most popular way to user name constraint is to create a look at control and this is where you have a control here and you move it around and the eyeball will always look at that controls position now yes this is the most popular way to demonstrate a name constraint but aim constraints are very powerful constraints they are used widely in rigging across all different aspects one that comes to mind is to help control shoulder and wrist rotation so that you get a nice natural deformation in those areas and are able to move your rig around freely without worrying about areas twisting or bending or not deforming correctly so M constraints can be used in that sorts of setup but yeah for now I'm just going to focus on the basics so let's just look at how you would use a name constraint just to get these eyeballs to follow these controls so we're just going to go to the rigging menu set and go to constrain again and I'm going to go to M and open up the options now there's a lot more in here to do with M constraints compared to a parent constraint for example and just looking at this it just looks very complicated but I'm just going to reset the settings just to make sure we're looking at the same thing but let's just add a basic constraint and see what happens so we want this eyeball to follow this so we basically want to constrain this joint to this control so slightly control select the joints click apply and you can see with the default settings this isn't working and that's because our aim vector which is the axis which needs to point towards the control is set to X whereas if we select our joint you see we the y axis here is the one that needs to be the one that points to the control so let's select the control again select the joint now one thing one good thing about am constraints is let's say we applied that and it wasn't right you can go into the attribute editor and then if we select the constraint node we have all the options down here so we can edit it after we have applied it so this allows you to play around with the settings to get to the setting that you want so I know that the aim vector is set to X but I want it to be set to Y so I can come to aim back to here so that's a zero and then set it to 1 for Y and there that's that's correct so far but now we have Z pointing down if we look at the other eye you see we want X pointing up where as X is pointing out to the side so again let's go to our aim constraint and let's have a look so the up Vector for this is set to Y which is clashing with the aim vector now what an aim constraint tries to do is it uses the aim vector to point towards whatever you are specified to whatever you've told it to look at but it also needs to know which axis points up so by default we'll duck type is set to vector and what this means is you can specify this vector here so we're basically saying here we want the y-axis to be the up axis but down here we're now saying well the up axis is going to be Y as well so you can see we're getting lots of clashes so it's very much like when we looked at joints in a previous video when you are setting it up you need an axis to point down the bone but then you need to specify which axis points up so here we've got our we're saying we want the y axis to point up but then we want it to point up in the world's y axis as well so we're getting issues here so let's go back we will know we want the x axis to point up instead so we go to our up vector and we say we want X to point up and you can see that it's updated automatically because we have the we're editing the aim constraint we're not creating a new one and I'm going to set that one to zero so all we've said is we want Y to point down towards the locator or the control here but we also want X to point up and the up axis is the world's y axis here so I hope you sort of follow it along there so let's do it on the other I will select the control we select the joint so we want the y axis so we don't want that so we want the y axis to point towards the control so we change that to Y we want the x axis to remain up so we'll set X in there and we'll remove that now we know the world axes y is pointing up so we can set our world up vector to Y which it already is click apply and that's worked now obviously if we wanted our practice to be down X or down Zed you know you can change that as well so just as a quick test let's close this and as you can see the eyeballs now follow those controls so this is quite a basic setup you know and this may be absolutely fine for your rig but we do end up with problems with just using the basic default settings so let's say if we wanted if the head ended up rotating round like so now you can't really see it with this so what I'm gonna do is I am going to just display the rotational axes and I'll do it on those as well just to be sure but you should see so if I just rotate these up once we get to a certain point see we end up with a flip and that's because when we've been setting it up we've told the constraint that we want X to always be pointing up to mimic the work the world seems our saw or axis so as so from here X is pointing up it's still trying to point up but at this point where it's starting to point down the joints flip at because it's trying to force X just continue to point up so that causes problems because we don't want if the head if the character sort of rolls or something I and needs to do something extreme or extreme with its head you don't the eyeballs flipping or you could have this set up with something else and as soon as you rotate or pass that point you end up with it flipping and this causes no end of headaches when it comes to creating rigs so let's remove those constraints and let's love a look at other options available tools so let's well actually let's not remove those constraints because as I said before the beauty of these is you can edit them as you're working on them so let's look at this constraint so we know the issue is the up Vector because our aim vector is find we want Y to point at the control so that is fine we don't need to do anything with that so let's have a look at the different world up type that we can choose now scene up will pretty much do what our vector is doing now it will just follow the scenes so the world axis basically and it will just but that locks it if you see if we select scene up this is grayed out then because what it's saying is just copy the scene whatever the scene is pointing up so the y axis that is the world up type whereas the difference is with vector you can specify so we said we wanted X to point up now here we have it set so X is going to point along Y but you have the freedom to point it in any of these directions so if I set that to zero we set that to zero something you can see it changing because it's trying to look along that so if we set that back to Y and that's just the same as seen up so nothing changes there so if you know you want your vector to just be these default values so set to Y you could just use seen up so the next one is object up and here you can specify an object that you want you want this to always try and look at well well basically it it's already looking at an object but what you are saying is we want the up well the up axis to also try and follow that object as well now at the moment we haven't got an object specified that's why it's changed because it's tried to put in some sort of default values it's trying to use the the world route so we need to put in an object just to make sure everything works now you don't have to use the control you could use a separate object to give you a bit more flexibility but just for the purposes of this I'm just going to use the control as well so if I put that object in so this is one of those instances where the if you notice the axis is flipped and I suspect that is because when we created our look at control the eyeball actually looked down slightly when when it started to aim so what I'm going to do in this instance is I'm going to delete that constraint I'm going to reset the rotations get it back to basics now we could just make sure that we add on maintain offset as well if we didn't want the eye to move down so let's select those and we want our constrain aim so in order to prevent the AI from rotating down slightly I'm just going to use maintain offset so we want Y to point down the bone and we want to set this to object up and I'm going to put that control in the world of object and we want X to point up so if I click apply now those axes are a lot better than they didn't flip upside down so like I said either it was because of the maintain offset so let's just try it turn off maintain offset click apply yeah so it's because of that so that's my fault because I didn't check that the eye was rotated correctly it's just pointing up slightly but you know you come up with these issues all the time and I could edit the video and just crop this out but it's probably good for you to see you know sort of problem solving as you're going in case you come up with some of these issues so I'm gonna put maintain offset on click apply let's do the same with they say obviously we want this control instead which is right I click apply so the issue we were having was that as we were rotating around like sir because X was always trying to point up and he was trying to follow the scenes up once it started to come to a point where it was pointing down it was starting to flip but as you can see now we don't get any flipping because it's being told that X is pointing up sort of relative to the the pivot point of the control so that's a way of fixing that issue if you end up with flipping like sir see we can rotate it all the way around and it doesn't flip you know so just using object let's have a look object up instead that will rectify that now the problem is it doesn't fix all issues we can rotate out like that but as we start to rotate around like so as you can see the z-axis is starting to point down so we're ending it with even though we've fixed the twisting in one plane it's happening in another which isn't great so what we can do instead let's have a look at our other options now instead of using object op we could use object rotation up and again this is just so now Zed is pointing up so we need to experiment with some of these because the problem we have is the joints rotational axes are different to the controls rotational axes so sometimes you can just you just have to experiment with some of these just to get the one that works best but basically what it's trying to do is it's saying this objects up should follow the objects the specific basically right I'll start again what it's trying to do is saying right take this object which is the right eye control and use a specified axis as the up back-up axis and what you can see is as I rotate this like so the eye is rotating with it because it's using the axis so it's saying X needs to point needs to follow the y axis here so if I do the same with this one so now we can rotate around this axis and it works absolutely fine and the issue we were having before was with as we turned around you know a Zed was starting to go down but this is much better as you can see the axes are completely solid because they are using the objects here to control which where that where they are pointing up now what this does allow us to do is say yes this is working fine our up axis is working fine there's no flipping but then we've got a bit of extra control so I can say it well I could want to tweak that a little bit just by rotating like so so it gives you a little bit more flexibility but it also helps to eliminate those issues where you get the axis flipping or turning or rotating when you don't want it to so that is basically setting up m constraints and the various options available there you know and as you've seen they can be quite tricky to get your head around but once you sort of understand the basics you can experiment and play around with them just like we did we applied one and it didn't work but then you can go in and you can edit it to get it to do what you need it to do and like I say there were a few bumps in the road on this bit of the tutorial but I'm not gonna edit those out we'll leave them in you know if you have a similar problem when you're creating a name constraint hopefully this shows you sort of how to problem-solve and get around it so we've come to the end of this second video in this series and we've looked at connections and constraints so I'd like to do is in the next video take things a step further because we know how to build and edit joints we know all about how to connect things to joints so now why don't we have a look at how to build your own custom controls so if you found this video informative and helpful please like it and leave a comment below comments are also always handy also remember to subscribe so that you can keep up to date with future videos in this series and I will see you on in the next one [Music] you you
Info
Channel: antCGi
Views: 37,907
Rating: undefined out of 5
Keywords: rigging, maya, autodesk, rigging in maya, connection editor, constraint, parent, aim, orient, point, maintain offset, up vector, world up type, flipping, stop flipping, tutorial, help, eye, eye rig, look at control, controls, orientation, aim vector, basics, fundamentals, game rig, 2019, maya 2019, gamedev, game art, game development, game rigging, beginner
Id: Fzpc2RpagGE
Channel Id: undefined
Length: 44min 32sec (2672 seconds)
Published: Fri May 10 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.