Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Moving a pivot to a vertex, then moving an object to a pivot?
  RSS 2.0 ATOM  

Moving a pivot to a vertex, then moving an object to a pivot?
Rate this thread
 
54075
 
Permlink of this thread  
avatar
  • Total Posts: 2
  • Joined: 07 April 2011 01:54 PM

I would like to learn some code and add it to my nice Mel Folder that I have created on my desktop.  But there is one problem… I need you to give it to me.  Alright… enough with the cute talk…

I need to know the mel code to make a pivot tool snap to a different location.  I either need the mel to move a pivot tool to a coordinate location, or to move the pivot tool based on the vertex I have selected.

Once I have moved the pivot point I will be able to move onto the next step.  I would like to be able to select the object who owns the modified pivot point and snap another objects pivot point to that one while moving the object in the process.

The ultimate objective is to move the pivot points of both objects then snap one object to the other based on pivot points.



Replies: 0
avatar

I have some pictures but i dont know how to post them.



Replies: 1
avatar

Take a look at the xform command in the Mel Command Reference.



Replies: 0
avatar
  • irobert
  • Posted: 11 May 2011 01:09 PM

This is a quick script I made to create a locator at the center of any poly based selection. This might help you along.

//Author: Robert Vignone - 11/06/2009 - http://www.robertvignone.com
//Creates a locator of the center of your selection (Verts/Edges/Faces/PolySurfaces/Grouped Polygons)
//No NURBS!
//Version 1.0

global proc r_getPivot()
{
PolySelectConvert 3;

string $sel[] = `ls -sl`;
string $clus = `CreateCluster`;
string $tmp[] = `ls -sl`;
float $loc[] = `xform -q -ws -piv $tmp`;

delete $tmp;

string $mkLocator = `CreateLocator`;
string $myLctr[] = `ls -sl`;

setAttr ($myLctr[0] + “.translateX") $loc[0] ;
setAttr ($myLctr[0] + “.translateY") $loc[1] ;
setAttr ($myLctr[0] + “.translateZ") $loc[2] ;
rename $myLctr “tehPivot”;
}
r_getPivot;



Robert Vignone
http://www.robertvignone.com
Win 7 | I7 @ 3.6ghz | 24GB DDR3| GTX580 |

Replies: 0