View Full Version : rigging FK > IK IK > FK
Kermit 01252008, 10:34 AM hi,
i setup an IK/FK Arm
i have 3 Control for my FK chain ( shoulder, elbow, wrist ) only rotation
i have 2 Control for my IK ( elbow : Z rotation wire ti swivel angle, wrist : pos and rot )
no problem for fit FK chain to IK chain, i use some points helpers for calculate the good rotation of each FK controller
but i don't find methode for calculate swivel angle of my IK chain when i want to fir IK to FK chain
some tips ? a direction ?
thx for your help
Kermit


f3derico
01252008, 10:40 AM
i'm doing a scripted character rig and first I tried to wire rot to swivelangle but I've return your same problem.so I've used a target object to control the ik elbow.It can be aligned to fk elbow and then offsetted a bit.it's the only solution I've found (but I'm not very expert in rig). I'd like to see your ik/fk solution to compare with mine. if you want :)
Kermit
01252008, 10:48 AM
hi f3derico,
humm, my animator's studio prefere to use a "Circle" rotation for control swisel angle, because is always in elbow position
so i need to calculate :(
f3derico
01252008, 11:07 AM
yes, it was my first choice to control swivelangle with a "circle" rotation but i'm not able to calculate it.
if you will do let me know :)
Ok,
Basically your driving the swivel with a variable, but the problem is, is that its a position that your trying to match. So basically we trying to match ab using c; now the only real way is to use iterations. (funnily enough its what jason schiefler came up with also). We need to iterate, the circles z value till they match, but we need to do it in a way that it takes the 'shortest' route  otherwise the fcurves will be not correct.
for i = 1 to 50 do  the ammount of iterations
(
d = distance $a $b  distance between lower leg fk and lower leg ik.
if (d > 0.0) then  is the distance at 0?
(
$c.rotation.controller[3].value += 0.01  lets rotate it by 0.01.
if (distance $a $b) > d then  check if its closer or further.
(
$c.rotation.controller[3].value = (d/2)  minus half the distance to it.
)
else
(
$c.rotation.controller[3].value += (d/2)  add half the distance to it.
)
)
else
(
exit  exit the loop once we're there.
)
)
Now this can be done with anything, not just distance  we could infact get the angle between the bones, but it's a little more tricker to find the middle vector needed. If you need help on that let me know.
cheers,
Well can't you get the angle needed from the angle between the first FK joint and the parent of the first IK joint? NOt tested but I can't see why you would not be able to do it.
If you are using a target object you need to calculate some vectors to get where to position the target object. So you get the mid position between the first and last joint and them cast a vector from there through the middle joint out exnumber of units and place your control there.
Kermit
01262008, 03:45 PM
hi all,
thx for your answer.
After few research and some math, a scratch code
Shoulder=$CTRL_FK_Shoulder
Below=$CTRL_FK_Below
Wrist=$CTRL_FK_Wrist
 calculation of transformation of my FK Plane
vectorX=normalize(Shoulder.positionWrist.position)
vectorTmp=normalize(Shoulder.positionBelow.position)
vectorY = normalize ( cross vectorX vectorTmp )
vectorZ= normalize ( cross vectorX vectorY )
theMatrix = matrix3 vectorX vectorY vectorZ [0,0,0]
Shoulder=$CTRL_FK_Shoulder  same position
Below=$CTRL_IK_Below  swivel angle on Z axis
Wrist=$CTRL_IK_Wrist
 calculation of transformation of my actual IK Plane
vectorX=normalize(Shoulder.positionWrist.position)
vectorTmp=normalize(Shoulder.positionBelow.position)
vectorY = normalize ( cross vectorX vectorTmp )
vectorZ= normalize ( cross vectorX vectorY )
theNewMatrix = matrix3 vectorX vectorY vectorZ [0,0,0]
rot =(theNewMatrix * inverse theMatrix).rotation as EulerAngles
 Add the angle difference between both plane, it's in this case X
 controller[2] because i freeze the rotation
Below.rotation.controller[2].z_rotation = Below.rotation.controller[2].z_rotation + rot.x
all is ok, only a little rotation on bone axis, may be need to resetup clearly
Kermit
CGTalk Moderation
01262008, 03:45 PM
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.