Maya Programming with Python Cookbook by Adrian Herbez

Maya Programming with Python Cookbook by Adrian Herbez

Author:Adrian Herbez [Herbez, Adrian]
Language: eng
Format: azw3, epub, pdf
Publisher: Packt Publishing
Published: 2016-07-29T04:00:00+00:00


If you look at the documentation for the spaceLocator command, you'll see that there is a position flag that can be used to set the position of the created locator. However, note that we're not using that flag in the previous code. This's because while the locator will appear to be at the specified position, the pivot point for the locator will remain at the origin. Since we're creating the locators specifically to use them to grab positions in world space, which makes things difficult for us.

There's an easy workaround, though we'll just leave the position unspecified, which will cause both the locator and its pivot to be at the origin, then use the xform (short for "transform") command to set the position of each locator to a reasonable starting position. This ends up looking like the following:

cmds.xform(kneeLoc, absolute=True, translation=(0, 5, 0)) cmds.xform(hipLoc, absolute=True, translation=(0, 10, 0)) cmds.xform(footLoc, absolute=True, translation=(2, 0, 0))



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.