Hi
I'm trying to use some MEL code to orient a EP curve control to a joint and while it puts the control in the correct orientation it offsets the control away from the joint. Why does this happen? The code is below:
___________________________________________________________________________________________
{
string $sel[] = `ls -sl`;
float $rotate[3] = `xform -q -ws -ro $sel[0]`;
float $translate[3] = `xform -q -ws -t $sel[0]`;
xform -ws -ro $rotate[0] $rotate[1] $rotate[2] $sel[1];
xform -ws -t $translate[0] $translate[1] $translate[2] $sel[1];
}
The first image is how the code is supposed to work correctly: by orienting the control to the joint.
The second image is how the code works now: it offsets the control away from the joint.
Replies
float $translate[3] = `xform -q -ws -t $sel[0]`;
you should get the position of one of the pivots
like this
the -rp bit stands for Rotate Pivot
and instead of using the xform command to move the control to the pivot just use