I want to create a simple command, that will take the selected components and align them to a point under the users mouse, limiting the movement to a single axis.
This can be done in default Maya but its cumbersome and involves multiple steps:
The above is one of my favourite features in Maya, I uses it all the time. I really need to streamline it. The command I have in mind is:
The following is what I so far have, it works but with one limitation, the "target" vertex is hardcoded:
global proc snapToPoint(string $axis){ string $sel[]= `ls -flatten -orderedSelection`; vector $target = `pointPosition -world pPlane1.vtx[1]`; // <--- replace this hardcoded value with the vertex under the pointer if ($axis == "x") move -x ($target.x) ($target.y) ($target.z) -worldSpace $sel; else if ($axis == "y") move -y ($target.x) ($target.y) ($target.z) -worldSpace $sel; else if ($axis == "z") move -z ($target.x) ($target.y) ($target.z) -worldSpace $sel; }
This is why I need a way to get the vertex under the users mouse or the one that is being highlighted, as shown here:
I am on the latest Maya.