Using an IK Rig to pose an FK Rig in Blender for Unity's Mecanim

I stumbled upon the topic where 2 members of Blenderartists were trying to achieve (what sounds like) exactly the same problem that I had this idea for.

Not sure if how many people know but Unity now has Mecanim and the free version doesn’t let you use IK so you can only use FK. ( I’m not sure if that is relevant or not or what exactly it applies to but I have found that my IK rigs do not work with the free version of Unity and Mecanim )

However, what I do know is that if you save a .Blend file rigged for IK… Mecanim fails to load it properly and… any animations you create can not be re-applied to a compatible Mecanim frame.

Which brings about a problem… how do I quickly make animation sequences (actions) that are Mecanim compatible without IK?

My best idea yet…

Create them using a rig made up of Mecanim compatible bones… AND IK Controller Bones.

Only save keyframes for the FK portion of the bone structure so positions are remembered and the IK Controllers are not saved for each keyframe.

Once you are finished, you can simply save 2 copies of the .Blend file…

  • 1 copy has the controllers still in it so you can make adjustments or keep creating more animation sequences (actions)

  • 1 copy has these controllers deleted as they are not required for the bone animations to work since these animations are only mapped to the FK portion of your rig.

The problem I’m getting is similar to the one explained in the forum topic, though slightly different :

The Controller IK bones are able to be saved as keyframed changes, but the changes they are making on the FK bone structure are not saving. I look at their transform properties and sure enough they are not updating as I move the Controller IK Bones.

The solution of applying visual transformation under the Ctrl + A menu makes all the bones stretch and go out of wack so it doesn’t appear to be working.

Is there now a better way to do this with Blender or is there a setting I should ensure is turned on for the FK portion of the rig to make sure that it works?

Please advise as any help on this would be appreciated.

I have uploaded a copy of my Blend file for others to look at as well.

I have the IK rig on the 1st layer and if you get rid of the bones grouped as “Controller” bones what’s left has been applicable to Mecanim animations in other tests I’ve done.

The only problem with it as is… would be that the Upper Leg bones need to be parented by the Pelvis bone offset… haven’t done this as it breaks the IK the way it’s rigged up.

Optionally I do have another Blend file with a cleaner FK rig which could be used as the target for the IK controllers.

n.b. this rig was constructed under the supervision of a tutorial so I’m quite new to rigging in Blender and would not know the technical means to apply IK controllers successfully to my other (rigify based) FK rig without some better information that explains exactly how and why each controller works in the IK rig I have set up.

If anyone wants the FK rig version for testing just let me know and I’ll upload this as well.

Thanks,
Jax

Attachments

deletabletest.blend (1.09 MB)

Moved from “General Forums > Blender and CG Discussions” to “Support > Animation and Rigging”

Seems pretty complex for something is essentially solved by animating with Visual Keying… or having an FK rig and posing with AutoIK.

If I understand correctly, you simply want to change your animations using IK (for example a walk) to its FK equivalent, right? (instead of keying only the feet, translate it to keying the feet,shin and thigh bones)

To do this there’s a function I use, snap FK to IK (and viceversa) taken from “Clive”, a rig made by freen here for a cgcookie series.

However, your rig setup doesn’t seem ready for that. Ideally you should have 3 copies of your bones: one deformation, one FK and another IK (FK and IK with no deformation)*. The deformation bones will follow the FK or the IK based on a copy transform constraint. That way the user can decide with a slider when to use which.

I’d recommend to revise your rig based on that. Otherwise I think getting the bone transform of a bone controlled by IK will inevitable include some math and python digging.

*edit: I’m not sure if this constraint is allowed in unity or if you need your deformation bones to be the actual keyed bones, in that case you can use 2 layers, IK and FK/DEF.

Hi guys thank for this extra information. These methods you describe are helpful too. I was also able to locate this little Gem : http://www.harkyman.com/2010/11/26/r…into-fk-bones/

This has worked a treat thanks to the tip-of about visual keying.

p.s. to have Mecanim work with your exported animation sequences, as far as I have been able to test, they must be exclusively deform/fk sequences. Any IK constraints will warp the animation flow as it will be with reference to bones that aren’t part of the base structure.

Generally IK always uses control bones which is what I’m referring to. if it were to be IK constraints without the control bones then perhaps it would work…but I haven’t yet tested this out due to lack of time available currently.