I'm doing a script where I need to get transform values such as translation from an object. I've noticed the pivot can be moved around but that won't update the transforms correctly, If I have a cube say and the pivot is at the center, I duplicate the cube and move the pivot to a corner of the cube and rotate it 90 degrees and translate it along an axis applying the same values won't place the original cube at the duplicated ones position.
I'm figuring the best way to do this is center the pivot, point/orient/scale constrain a locator to the object to snap to its centered pivot, remove the history and get the locators transforms which can then be applied to the original cube to position it the same as the duplicate version.
Is there a better way to do this?
Replies
Gets the position of the scale Pivot in world space.
xform -q -rp -ws $ObjectName;
I forgot to mention that I was using maya and the language was python, I've come up with this long method: I wasn't able to make complete sense of m4dcows solution (not too experienced with scripting). But bk3d's solution got the same translate values as my method above which is great, applying those values and the duplicateds rotation/scale values seems to work perfectly. Should I be concerned about the scale pivot?
The aim is to import an asset (which had its pivot centered and exported from being snapped to the origin), then manipulate various copies in maya and through a script get the correct transform values to use in a game engine to build levels through modular pieces. Level iteration through the engines editor is very slow thought this would make more sense.