Search Unity

Question Animation Rigging: IK Target doesn't stay still, affected by motion of model

Discussion in 'Animation Rigging' started by dgoyette, Jul 6, 2020.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    I'm just getting started with Animation Rigging, and I figure there's a bunch I don't know. But I'm just trying to set up a simple two-bone IK for the arm, and running into unexpected behavior. I would have thought the hand would stay wherever I put it. Instead, it bounces up and down along with the rest of the model.

    Here you can see the IK I've set up for the left hand. Without this IK, the hand would normally just be swinging back and forth, like the left hand. But I was expecting the

    IK.gif


    I don't have the IK target as a child of the model, and the "Target" stays in one place the whole time. So, the Target isn't moving. It's just that the model isn't fully honoring the position imposed by the IK constraint.

    upload_2020-7-6_16-24-19.png

    Am I wrong in assuming that the hand should stay exactly on one spot, rather than move like this? Both the Rig and the Constraint have their weight set to 1, and there are no other rigs of constraints being used.
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    I seem to have found a way around the problem, though I'm not sure it's quite correct, since it's not the way I've seen any of the examples set up.

    The approach was to place the Rig Builder on the same object that contains the model's Animator, and to make the Rigs children of the model. You can see my original setup in my first post, which didn't work. The following setup seems to work as expected:

    upload_2020-7-6_21-19-27.png

    Using this approach, the hand stays perfectly still. I'm not sure if someone else can confirm whether this is a reasonable/correct approach, and why it makes a difference.
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Well, it seems that's not a great solution. Using that approach causes other constraints not to function properly. For example, Override Transform doesn't cause position override when used in this way. It still causes rotation override, but it doesn't change the position of the bone anymore. So I'm assuming this isn't generally the right approach to setting up the Rig Builder.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    I found a way to resolve the issue where Override Transform wasn't allowing the position to be adjusted. It appears that simply turning on "Translation DoF" in the rig configuration is all that was needed to get this working. I don't know why it was necessary in one case but not in another.

    Anyway, at this point, the second approach I've described here (my second screenshot) appears to work as I'd expect things to work. I'll update this if I run into further issues.
     
  5. davehunt_unity

    davehunt_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    32
    Hi dgoyette,

    Yes, you are correct when you said that RigBuilder needs to be on the same GameObject as the Animator component. And all rigs should be below that in the hierarchy. Without it set up this way it's not a valid rig and won't work as expected.

    Here is a nice video about Animation Rigging by Brackeys that explains how to make a correct setup with Animation Rigging in case you want more information about this.


    I hope that is helpful, and thanks for posting your questions.
     
    trombonaut and x1alphaz1 like this.
  6. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Thanks very much for the confirmation. I think my initial caution was based on my tendency to avoid placing anything on an imported model directly, and only use the model as a sibling object, in case I need to swap out the model later. But in hind sight, it seems obvious and reasonable that the Animation Rigging scripts would be tightly coupled with the model's Animator.

    I wonder if it would be simple for you to emit a warning if the Rig Builder detects that there's an Animator component on a subobject, to avoid others trying my incorrect setup? Or maybe there are reasons why that's actually okay, and it's difficult to warn about this kind of thing.

    Anyway, I think I'm all set for now. But maybe this thread will help someone else who initially sets things up incorrectly like I did.
     
  7. x1alphaz1

    x1alphaz1

    Joined:
    Dec 19, 2020
    Posts:
    23
    true... RIG setup has to be done on the top level Parent Object.
    Otherwise rigs Animation behaves abnormally....