Search Unity

Question How to retarget a generic rig?

Discussion in 'Animation' started by GeriB, Jan 26, 2022.

  1. GeriB

    GeriB

    Joined:
    Apr 26, 2017
    Posts:
    193
    Hello everyone,

    Is there a way to retarget a generic rig? Imagine an arbitrary custom hierarchy. Is there a way to retarget animations made for that hierarchy to another hierarchy that doesn't share the same Gameobject names?

    This is being a problem for VR Hand animation retargeting. I have identical hierarchy hands but no matter how I play around with the generated avatars I can't get the animations from 1 hand to play on the other hand.

    Is there a practical way of approaching this problem?
     
  2. unity_2cdeity

    unity_2cdeity

    Joined:
    Dec 19, 2020
    Posts:
    17
    only if it has the exact same bone structure, the only way to do it if it doesnt would be to fully add a bone structure that is the same and weight it accordingly.
     
  3. GeriB

    GeriB

    Joined:
    Apr 26, 2017
    Posts:
    193
    I haven't even found a way to do it when the hierarchies/bone structure match perfectly. Can you point me at any resource I can take a look at?
    I haven't had any luck myself
    In any case thanks for the response
     
  4. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    674
    get the animations from 1 hand to play on the other hand.

    this is not retargeting.
    this you could do if
    1. add another layer in animator, and animation state
    2. add a mask for one hand
    3. mirror the animation played on the first state (probably will need to adjust the cycle offset too)
     
  5. GeriB

    GeriB

    Joined:
    Apr 26, 2017
    Posts:
    193
    I was trying to retarget a set of animation from 1 set of hands to another set of hands made by some other person
    But yeah, animation is hard XD
     
  6. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    674
    I see, I missed that.

    have you tried copying rotations directly? (if starting rotations are similar this might work)

    then multiply (local-) rotations by quaternion.euler to compensate error
     
    GeriB likes this.
  7. unity_2cdeity

    unity_2cdeity

    Joined:
    Dec 19, 2020
    Posts:
    17
    I believe you can use the other avatar as the model when you import. However if the genaric rig is exactly the same it should work in the preview box and ingame.,
     
    GeriB likes this.