View Full Version : object constraint
07-20-2010, 10:09 PM
Its a pleasure to cyber meet ya :)
im not new to rigging but im not super advanced either. for instance i know my way around maya pretty well (still learinging new things of course), but now im starting to pick up on the mel scripting/ coding aspect of rigging.
so I have a question:
I have a character (a little boy) who wears a back pack and a helmet. What I want to do, is constrain the helmet and back pack (separately of course) to the boy. The back pack and helmet are to be of course attached the the head (helmet) and the back (back pack) and also they are to be held in each of the boys hands. aaaaand i want the helmet and back pack to have the option to not be attached to anything... am I being clear enough?
Now, I have accomplished this with constraints, groups, locator's and set-drivin keys and yada yada yada, but when ever I switch the objects constraint it jumps from one constraint to the other. Is there a way to change the constraint with out the helmet/ backpack jumping from constraint to constraint?
Here's a script that hides all the complex stuff and manages the position matching when you swap parents
But if you want to get into some mel and write your own, then you may find the zooToolbox interesting, especially the zoo space switching. I wrote a brief intro here
07-21-2010, 07:00 PM
I'm curious as to what exactly space switching and auto snap is? I have been running into these terms allot lately. Victor Vinyals demonstrates it in his businessman character rig. I guess he was able to lock the IK controller to the head controller and torso controller.
07-21-2010, 07:35 PM
also I am definitely getting into writing my own scripts. I ordered the "Mel Scripting a Character Rig in Maya" book by Chris Maraffi I'm hoping that will get me started.
So... this ZooToolBox is free to download? and i can go through the scripts and see how its put together?
07-22-2010, 05:51 PM
When you apply a parentConstraint each time you constrain to an object the parentConstraint stores an offset from that object. This is the distance from the object that you are constraining to and also the rotation offset. When you first constraint to one or more objects you can switch between these constraints and there will be no movement. Each object your node is constrained to could be in a completely different position/rotation but the constraint stored the offest for each. Now if you move an object that your node is constrained to the offsets no longer all match up.
When you changed the weights on your constraint you get the result of the following:
targetOffset.position/rotation + targetNode.position/rotation
If the targetNode's position and rotation changed then your constraint will cause your object to move. To solve this people write scripts to save the current world position/rotation of a node then change the weights then restore the original position/rotation of that node.
You probably found the toolbox by now, but I should have posted the link.
Hamish has started rewriting stuff in python (and thats the thrust of his blog lately). Its a great place to learn, but may be a bit advanced if you're just starting out. Or maybe you're a fast learner.
07-23-2010, 09:56 PM
Thanks a buch Ryan and David. I did found his website already. it was hard to believe that a cool set of tools are just free like that. I do want to start developing my own scripts and learning mel and python. is python the newer version of mel or better than?
07-26-2010, 08:18 AM
Its hard to sum it up really. MEL is good for those learning Maya because Maya prints out MEL statements in the script editor. However Python gives you a lot more flexibility but for some it might be overkill. If you desire to be a technical artist of any sort I say you should learn it. Maya uses Python, XSI, Houdini, and Motion Builder So by learning it you just learning how to script in several packages.
07-26-2010, 10:16 AM
...and Realflow, 3dsmax (http://www.rtrowbridge.com/blog/2009/02/python-in-3ds-max/) (well, it should have a much better integration when they rewrite everything)... It's becoming the defacto standard for scripting.
It's very simple to learn, has a great set of libraries (think matrices, maths/geo) has a large user base, can be used for windows/linux/mac file handling etc... It's also very useful in maya when testing out plugin prototypes.
07-27-2010, 02:14 AM
Thanks again guys. For all the great info.
07-27-2010, 02:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.