Quote:
Originally Posted by Rob Galanakis
I cannot believe there is no out-of-the-box align tool, especially considering how essential it is for animation. It would take literally a few hours to create and test something like that... You can try this script, supposed to be like Max's align tool:
http://highend3d.com/maya/downloads/...Tool-4470.html
|
Does the script reflect how it's done in Max?? I can't seem to get good results. How are u supposed to get orient joint values from rotation?
Hito,
If you know how rotation order on joints affects axis and create yer control objects accordingly. execute the following script.
else, before executing...
yer nurbs circle fer instance.
for example, a joint rotation order of xyz...
The joints would then run along x axis.
SO... create a nurbs circle with the x axis option chosen.
( or jes model/edit respecting that x direction. )
then execute the following:
/*
cly_orientControlToJoint.mel v0.01
Roger Klado was here
because no one else will do it fer me
November 14, 2008 ( jes keep swimmin' )
transfer a joints position and orient to a control object. Zero out objects rotation values by burying it in a group
usage:
1. select a "single" joint whose orient and position values are to be transferred to a control object(s).
2. Select one or more "target" objects to be re-aligned and re-positioned.
( order of step 1 and 2 is not important )
3. execute this script.
requirments:
for predictable orientaion...
script assumes control objects are created and or modeled respecting rotation order of joint.
eg.
axis ( if the the reference joint "runs" along it's x axis then your control objects intended head to tail should run along the x-axis as well )
direction ( negative positive direction dictated by axis order of joint as well: control object is modeled head to tail or visa versa depending on desired direction )
*/
global proc cly_orientControlToJoint() {
// selections and error checking
string $jointInQuestion[] = `ls -sl -fl -type "joint"`;
if (`size( $jointInQuestion )` != 1 ) {
error "cly_orientControlToJoint requires that only \"one\" joint be selected before running";
}
string $victims[] = `ls -sl -objectsOnly`;
string $controlSelections[] = stringArrayRemove ( $jointInQuestion, $victims );
if (`size( $controlSelections )` < 1 ) {
error "cly_orientControlToJoint requires that at least one object for alignment, must be selected before running";
}
// selections and error checking end
float $jointPositionValue[] = `xform -q -ws -t $jointInQuestion[0]`;
//aim control and zero out rotation values by burying in a group ( target objects aligned and zeroed )
for ( $c in $controlSelections ) {
string $cGrpName = $c+ "RotateGrp";
string $cGrp = `group -name $cGrpName $c`; // because zero rotation "home" values are good when animating
xform -ws -t $jointPositionValue[0] $jointPositionValue[1] $jointPositionValue[2] $cGrp; // align the group not the object
string $aim[] = `parentConstraint $jointInQuestion[0] $cGrp`;
delete $aim; // clean
makeIdentity -apply true -t 1 -r 1 -s 0 -n 0 $c; // zero possible transforms // to do: preference
}
select -r $victims;
}
// the end