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

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2013
IK Forearm Twist driver for rotations past +-720 degrees?

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;
    $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
  02 February 2013

The Problem:

The 2nd Sort-Of-But-Not-Quite solution:
--- The nobleman makes nobleplans and by nobledeeds he stands! ---
  02 February 2013
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.
Thread Closed share thread

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
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:09 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.