Hi, this may seem like a simple issue, especially for a MEL scripter, but I was simply wondering how I can preset the pivot point of any new poly object to align to the bottom. I like to be a bit more precise with my units, so I prefer to uncheck Interactive Creation and type in W H and D.
Thanks in advance!
-Andy
Hi @andymc4997
This would take some fancy scripting to have this change by default.
If anything, it would probably be easier to have a script be a button that you can press to set the pivot point to the bottom of the mesh when clicked as opposed to when the mesh is created.
All the best,
Sean Heasley
Technical Support Specialist
Autodesk Here to Help | My Screencasts | Autodesk Virtual Agent | How To Reset User Settings | Installation and Licensing Forum | Maya Certified Hardware |
Hi Sean, and thanks for your reply!
A button would be fine as well. I guess I assumed it would not actually be hard to script, so thanks for the input there.
The process I currently follow is:
- After creating object, orbit and zoom to the bottom.
- Hold the D key and select the bottom-most component of the object to reset the pivot point to it.
- Enter 0 for the Y axis in the Absolute Transform area
This does seem easy enough, but when modeling multiple objects, it would save time if each new object's pivot point could be preset to the bottom. I'm in the process of modeling many different pieces of furniture and they need to always be "grounded" to the origin. Hope that makes sense.
Thanks again
sometimes you can hack a little script from the script editor, here's a button from the Bonus tools pivot script.
Use all the time but don't ask me to change anything, I'm not a programmer.
I think you'll like it.
source bt_alignPivotToBoundingBoxWin; optionVar -q bt_CenterPivFirst; optionVar -q bt_IndividualBB; bt_alignPivotToBoundingBox 4;
python "import bt_zeroTransforms"; python "bt_zeroTransforms.run( mode='offset' )";
deleteUI bboxPivotUI;windowPref -remove bboxPivotUI;
Hi damaggio,
Gosh, I suppose I should have looked around Bonus Tools more thoroughly, my bad :(. This will at least make it a little easier, and I do like how you can position the pivot to Min and Max locations from the pop up box. But I'm with you on the scripting side. I'm a graphic artist/designer who walks sideways from the weight of my right brain, so, Lol.
Thanks!
To just be clear however... what I would LOVE to happen is that I simply type in my Width Height and Depth figures and BAM, the object sits on the origin lined up to it's base.
Hi!
I would be glad if i had more time to do a tutorial on this.
But as a hint: The pivot is not the problem, the pivot of a new object is at ground-level, so there is no need to move it.
The pivot is at the ground level? It certainly isn't for me, unless I'm just missing something right in front of me. For example, when I create a poly cube, the pivot is in the center, and the object is placed at the origin like so:
I
I would like for it to be like this:
Hi,
Perhaps then I didn't make myself clear. I want the base of the object AND the pivot to be at the ground level.
Hi!
You made it clear, but as said before currently i only have time for this short hint.
You can use the following script to move the pivot to the bottom of your model. The MEL script centers the pivot, then grabs the bounding box for your selection and re-applies the centered pivot from X and Z while putting the lowest bounds of your object's bounding box into the Y portion of the pivot. Enjoy!
float $bb[];
float $pivots[];
// center pivot on object
xform -ws -a -cp;
// store bounding box info into float array
$bb = `xform -q -ws -a -bb`;
//store centered pivots into pivot float array
$pivots = `xform -q -ws -a -piv`;
// set new pivots, X, Z from centered pivot, Y from lower bounding box
xform -ws -a -piv $pivots[0] $bb[1] $pivots[2];
Hello everyone, I found this entry after I created my own "multi object solution" to this theme. I hope you've finished your cards by now. Nevertheless, I'm sending you my script. Maybe someone can use it....
{
// https://www.hein-liessem.de
string $sel[] = `ls -sl`;
for($i=0; $i < size($sel); $i++)
{
//print($sel[$i]+"\n");
string $currentObj=$sel[$i];
select($currentObj);
CenterPivot;
FreezeTransformations;
float $oldpos[] = `getAttr $currentObj.rotatePivot`;
float $Min[] = `getAttr ($currentObj + ".boundingBoxMin")`;
float $Max[] = `getAttr ($currentObj + ".boundingBoxMax")`;
float $sum[];
$sum[1]=(($Max[1])-($Min[1]));
$sum[1]= $sum[1]/2;
xform -os -piv $oldpos[0] $Min[1] $oldpos[2] $currentObj;
}
}
The curly brackets at the beginning and the end of the script prevent the "redeclaration error"
Have fun....
Can't find what you're looking for? Ask the community or share your knowledge.