[Closed] rigging FK -> IK IK -> FK
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
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
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
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 a-b 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 f-curves 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.
[indent]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.
)
[/indent])
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.
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.position-Wrist.position)
vectorTmp=normalize(Shoulder.position-Below.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.position-Wrist.position)
vectorTmp=normalize(Shoulder.position-Below.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