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® / Modeling / Merge Vertices on two axes only
  RSS 2.0 ATOM  

Merge Vertices on two axes only
Rate this thread
 
61123
 
Permlink of this thread  
avatar
  • Total Posts: 1
  • Joined: 18 October 2011 05:21 AM

Hi,

I’m working on an inorganic model (a castle, to be specific) and found that many vertices have come out of alignment with each other. The walls of the castle should be very straight and, thus, all vertical vertices should be directly above or below each other, but they’re slightly off in the X and Z axis.

I’m looking for a way to quickly be able to select a cluster of them and have them center on each other in the same way that the Merge to Center tool does, but I don’t want them to center in the Y axis, as then the vertices will all be on top of each other.

I figured I can use two-axis movement to achieve this, but it’s a really slow process and I was hoping someone knew a way to merge them on two axes, instead.

I’ve included a few pictures so you can better understand.
The first is of the walls in perspective mode.
The second shows that the vertices don’t quite line up in the Top Orthographic view

Many thanks.



Attachment Attachment
Attachment Attachment
Replies: 0
avatar
  • ldunham1
  • Posted: 18 October 2011 07:04 AM

try using this script (ive just edited the one maya already uses (merge to center) but ignore Y axis)

global proc ld_polyMergeToCenter_edit()
{
 ConvertSelectionToVertices
;
 
string $selected[] = `filterExpand -sm 31 -ex 1`;
 
float $center[];
 
float $tmpLocation[];
 
float $xtotal 0;
 
float $ztotal 0;
 
$size = `size $selected`;

 for (
$vert in $selected)
 
{
 $tmpLocation 
= `xform -q -ws -t $vert`;
 
$xtotal +=  $tmpLocation[0];
 
$ztotal +=  $tmpLocation[2];
 
}

 $center[0] 
= ($xtotal / ($size));
 
$center[1] $tmpLocation[1];
 
$center[2] = ($ztotal / ($size));
 if (`
size $selected` > 0)
 
{
 select 
-r $selected;
 
move -a $center[0] $center[1] $center[2] $selected;
 
polyMergeVertex  -d 0.01 -ch 1;
 
}
}

just select your verts and run the script.



Lee Dunham | Character TD
ldunham.blogspot.com

Replies: 0