# IK Forearm Twist driver for rotations past +-720 degrees?

 Thread Tools Display Modes
 02 February 2013 TheN8man Analytical Perfectionist   portfolio Nathan Chisholm New Zealand IK Forearm Twist driver for rotations past +-720 degrees? Situation: A semi-cartoony arm, with an IK/FK setup; using separate chains for the FK, IK and bind (including around 7 forearm twist) joints. Challenge / Problem: I am looking for a way to enable the wrist to be twisted an indefinite (but for this post, +- 720 degrees) amount and still have the twist joints distribute the total rotation relative to the elbow; without the twist joints flipping back to the shortest distance when the rotation passes +-360degrees. How the twist is actually implemented is not the question. The issue is how to reliably calculate the total rotation of the wrist, around the axis/joint which would point along the length of the forearm ('twist axis'). Current Unsatisfactory Solutions: 1. Use a direct connection from the wrist control - Pros: No flipping of values; - Cons: This fails when gimball lock etc. results in either: the rotation that was connected not rotating the hand around the twist axis; or a different axis rotating the hand around the twist axis. 2. Use an expression, to calculate the rotation difference (of the IK wrist joint in the twist axis) since the last evaluated frame (ie. `getAttr -t (obj.lastEvaluatedFrameCustomAttr) obj.attribute`), countering any sudden changes (eg. 179degrees straight to -180degrees) by adding or subtracting 360degrees to the rotation difference between the frames, and adding that rotation difference to the value used to drive the twist. - Pros: When played from start (ie. rendered), or even scrubbed from animation start frame, the arm twist evaluates correctly with no twisting, provided the initial pose is non flipped. - Cons: The start frame assumes the arm/wrist pose to be at a non-flipped position, or otherwise the initial offset (multiple of 360) must be set manually; The arm twist does not evaluate until keyed; If a frame is jumped to on the timeline, the arm twist may not evaluate correctly. The expression may trigger the 'cycleCheck' warning. Does anyone know of a more practical method, preferably one that works without requiring keys? (Method 2. Experimental expression ): ``````if ((hand_ctrl.enableNoFlip == 0) || (frame == `playbackOptions -q -ast`)) { hand_ctrl.noFlipArmTwistRotation = wristTwist.rotateX; } else { \$frameDif = frame - attrHolderJnt.prevFrame; \$rotDif = ((`getAttr wristTwist.rotateX`) - (`getAttr -t (attrHolderJnt.prevFrame) wristTwist.rotateX`)); if (\$rotDif > 180) { hand_ctrl.noFlipArmTwistRotation += \$rotDif - 360; } else if (\$rotDif < -180) { hand_ctrl.noFlipArmTwistRotation += \$rotDif + 360; } else if (\$frameDif != 0) { hand_ctrl.noFlipArmTwistRotation += \$rotDif; } } attrHolderJnt.prevFrame = frame; `````` __________________ --- The nobleman makes nobleplans and by nobledeeds he stands! --- Last edited by TheN8man : 02 February 2013 at 04:13 AM. Reason: Added experimental expression code share quote
 02 February 2013 TheN8man Analytical Perfectionist   portfolio Nathan Chisholm New Zealand Examples The Problem: http://www.youtube.com/watch?v=i4P6...nbbycbYsX4xrj1N The 2nd Sort-Of-But-Not-Quite solution: http://www.youtube.com/watch?v=4sWV...X4xrj1N&index=1 __________________ --- The nobleman makes nobleplans and by nobledeeds he stands! --- share quote
 02 February 2013 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.