So im trying to set up a FK/IK switch, using xform to query the values of the joints. The problem im having is when I try to switch from FK to IK the wrist rotation dosent match. If I just run lines 3, 13, 14, 15 then I get the right rotation but the controller isn’t in the right spot. Now if I throw in lines 5 & 9, it matches up to the FK position but the IKwrst ctrl pivot seems to have rotated aswell, messing up the rotation. Heres my code, any help would be appreciated, google has been of no help. thanks
[ol]
[li] //-------------FK to IK[/li][li] // get rotation of FK wrist controler[/li][li] vector $ifwrstrotVec = xform -q -ro “FK_wrst_ctrl”;[/li][li] //gets positin of FK wrist controler[/li][li] vector $ifwrsttrnVec = xform -q -ws -rp “FKwrst_JNT”;[/li][li] //gets position of FK polvec follower[/li][li] vector $ifpoltrlsVec = xform -q -ws -rp “FK_polevect_follow”;[/li][li] //snaps IK controller to FK position[/li][li] move -rpr ($ifwrsttrnVec.x) ($ifwrsttrnVec.y) ($ifwrsttrnVec.z) “IK_wrist_ctrl”;[/li][li] //snaps polvect to FK follower[/li][li] move -rpr ($ifpoltrlsVec.x) ($ifpoltrlsVec.y) ($ifpoltrlsVec.z) “IK_polevect_ctrl”;[/li][li] //sets rotation of IK wrist controller[/li][li] setAttr “IK_wrist_ctrl.rotateX” ($ifwrstrotVec.x);[/li][li] setAttr “IK_wrist_ctrl.rotateY” ($ifwrstrotVec.y);[/li][li] setAttr “IK_wrist_ctrl.rotateZ” ($ifwrstrotVec.z);[/li][/ol]
SOLVED: i was able to fighure it out and apply it to a rig. all it needed was a worldspace flag on line 3 and then i just added delete orientConstraint under line 15. so there you have it