How to best setup an IK rig for programmatic control

I’m new to Unity and am attempting to create a character whose constrained (kinematic) motion is controlled programmatically.

I don’t see exactly how to accomplish this with Mecanim, though I assume that’s the “right” way to do it. It looks to be focused on applying baked animations to rigs.

I’ve also tried creating a rag-doll, pinning the root node in space, but this requires me to use force-based controllers which is way more complexity than what I need.

Unity certainly has an IK-solver under the hood somewhere; how do I use it? If I’m wrong in this assumption, is the only solution to write my own IK-solver?

Hey!
It’s not too difficult to set up basic IK in Unity.
You will still need to build animations yourself that will help guide your character in the right direction, but the simple IK (Inverse Kinematics) solver in Unity allows for runtime adjustments of animations through scripting with very little overhead. Unity’s IK system supports the following functions:

  • Arm IK
  • Leg IK
  • Look IK (head)

To get started with IK, I recommend the following couple of YouTube videos:

If you more prefer written documentation, Unity provides a walk-through of basic IK here:

Personally, I would suggest that you take the time to watch both videos AND follow the official written tutorial to get the most out of your IK solutions. It is, of course, your decision as a developer, though.

I myself have spent the last 3 days researching IK in Unity and just about everything simple is right here; past it gets very frustrating and complex. If you’re looking for more direct control & the resources I have given you here don’t cut it, I can expand upon them if you’re interested. Let me know if this helps. If you run into any pitfalls, don’t hesitate to let me know.

Best of luck to you, and happy developing!!

-YZM