Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question How do I constrain translation/rotation on particular axis in robot legs?

Discussion in 'Animation Rigging' started by brainwipe, Jan 16, 2023.

  1. brainwipe


    Aug 21, 2017
    Using IK, I need to restrict the motion of particular axis as per the image below:

    rigging issue.PNG

    1. needs to translate along X and rotate around Y.
    2. needs to translate along Y but no other angle.
    3. needs to rotate freely

    My setup is:
    rigging issue2.PNG

    The only constraint I have is the IK one and moving the target moves as you might expect - adding other animation constraints makes no difference.

    I have tried adding constraints of other types in the order of precedence listed here.

    I had some success adding not-animation constraints to the meshes but that only works in a limited way because I need the bones to be constrained, not just the meshes.

    I was hoping for a robot arm (or cartesian 3D printer) example because that should solve the problem but I can't find one. Furthermore I can't get any of the examples here to load. No official answer on a similar question here.

    Using Unity 2021.3.12f1, Animation Rigging 1.1.1

    How would I go about setting up the constraints/bone structure/model for this?

    Many thanks in advance.
  2. brainwipe


    Aug 21, 2017
    I found a solution using Animation Rigging. Here it is working:


    If you're using IK, you can partially constraint specific bones (using the standard non-animation rigging constraints) but the IK solver (either chain or 2 leg join) will override them.

    So don't use the IK system. Instead, rig your machine from "tip" back to "base" (using the language of robotics). For my mechanical ladybird, that would be foot back to hip. That not how you would build it in the real world but you can fake it this way so it looks good enough.

    The hierarchy is:
    faking ik hierarchy.PNG

    Note that the foot and middle are not parent/child. They are controlled separately. Also note that the order of the Rig Constraints (FootFollow, MiddleFollow...) is extremely important as they are calculated in top-to-bottom order. Constraints lower down the chain override constraints further up.

    Here are some of the constraints - hit image limit, more in reply.
    faking ik foot angle.PNG faking ik hierarchy foot follow.PNG faking ik middle follow.PNG
  3. brainwipe


    Aug 21, 2017
    Here are the remaining constraints. The angle for the top is set using a "look".

    faking ik shoulder follow.PNG faking ik top look.PNG

    Frankly, I would prefer to use IK and put limitations on freedom of movement on each bone as that's more intuitive.

    I hope this helps someone!