Contact Information

Email - Duylinh.Nguyen@gmail.com
Google Voice - 415-613-2177

Tuesday, May 17, 2011

Orient controller to joint script

//////////////////////////////////////////////////////////////////
//jointOrientController.mel //
//Scripted By: Duylinh Nguyen //
//Description: This script takes a curve, orients it to the //
//desired joint and applies an orient constraint on the //
//joint. //
//How to use- //
//type jointOrient "name of controller" "name of joint"; //
//ie. jointOrient shoulder_CON shouler_Jnt; //
//////////////////////////////////////////////////////////////////

proc jointOrient (string $conName, string $jntName)
{
//Creates a group Null
select -r ($conName);
group -n ($conName + "_NULL");
//Snaps the controller to the desired joint, rotates and freezes it's transforms
pointConstraint -offset 0 0 0 -weight 1 $jntName ($conName + "_NULL") ;
delete ($conName + "_NULL_pointConstraint1");
setAttr ($conName + "_NULL.rotateZ")90;
FreezeTransformations;
//Snaps the orientation of the controller to the joint
orientConstraint -offset 0 0 0 -weight 1 $jntName ($conName + "_NULL");
delete ($conName + "_NULL_orientConstraint1");
//Orient Constrains the joint to the controller
orientConstraint -offset 0 0 0 -weight 1 $conName $jntName;
}

No comments: