Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Axle Finder
- Select two edge loops on a mesh and run the script.
- A locator will be created in the center of the two pieces with the correct axle.
- */
- string $Edges[] = `ls -sl`;
- int $SelSize = size($Edges);
- for($E=0; $E<$SelSize; ++$E){
- select -r $Edges[$E];
- polyToCurve -form 2 -degree 1 -n ("PollyToCurve" + $E);
- CenterPivot;
- spaceLocator -n ("CenterLoc_0" + $E);
- parentConstraint -n "SnapConst" -weight 1 ("PollyToCurve" + $E) ("CenterLoc_0" + $E) ;
- delete "SnapConst";
- delete ("PollyToCurve" + $E);
- }
- // Doing an aim const to find the correct axis of rotation
- aimConstraint -offset 0 0 0 -weight 1 -aimVector 1 0 0 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 -n "AimConst" CenterLoc_00 CenterLoc_01;
- delete "AimConst";
- // Finding the center point of the locs
- float $LocA[] = `xform -q -t -ws "CenterLoc_00"`;
- float $LocB[] = `xform -q -t -ws "CenterLoc_01"`;
- // moving one of the locs to the mid point
- float $midPT[] = {($LocA[0] + $LocB[0])/2 ,($LocA[1] + $LocB[1])/2 ,($LocA[2] + $LocB[2])/2};
- xform -t $midPT[0] $midPT[1] $midPT[2] "CenterLoc_01";
- // deleting the other Loc
- delete "CenterLoc_00";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement