Answered

Transfer objects between rigs

kingtom14 10 months ago updated by Peter - Soxware Developer 10 months ago 1

I have two rigs, and I want Human 1 to give Human 2 an object. Now that object is a child of Human 1, how can I transfer it to Human 2, so it can have a parent from Human 2?

UMotion Version:
Unity Version:

Answer

Answer
Answered

Hi,
thank you very much for your support request.

If you want to do this in one single animation without any scripting, the only option is to make both characters "generic". Add them below one parent empty GameObject and add an animator to that GameObject. Then you can control both characters and the holding object from a single animation. This would be a good approach if you need this in a cut-scene, but wouldn't be suitable for an in-game mechanic.


If this is not an option for you, then things get a bit more complicated. This would require a mix of scripting and pre-made animations maybe even runtime IK on top of it:


  1. You create a "giving object" animation and a "receiving object" animation in UMotion (just the arm movement).
  2. Now create a script that plays the "giving object" animation on human A and the "receiving object" animation on human B at the same time.
    Use UMotion to place an animation event in the "giving object" animation that calls a scrit method in the right moment that uses transform.SetParent() to change the parent of the item from human A's hand to human B's hand. This would teleport the item from one human to the other.
  3. If you want a complex but more realistic behavior, where the hands actually meet no matter how the humans stand relative to each other, you would need to use runtime IK (e.g. Unity's animation rigging or FinalIK from the asset store). Unless this is THE core mechanic in your game, I wouldn't go so far though.

Please let me know in case you have any follow-up questions.

Best regards,
Peter

GOOD, I'M SATISFIED

Thank you! I will try that

Satisfaction mark by kingtom14 10 months ago
Answer
Answered

Hi,
thank you very much for your support request.

If you want to do this in one single animation without any scripting, the only option is to make both characters "generic". Add them below one parent empty GameObject and add an animator to that GameObject. Then you can control both characters and the holding object from a single animation. This would be a good approach if you need this in a cut-scene, but wouldn't be suitable for an in-game mechanic.


If this is not an option for you, then things get a bit more complicated. This would require a mix of scripting and pre-made animations maybe even runtime IK on top of it:


  1. You create a "giving object" animation and a "receiving object" animation in UMotion (just the arm movement).
  2. Now create a script that plays the "giving object" animation on human A and the "receiving object" animation on human B at the same time.
    Use UMotion to place an animation event in the "giving object" animation that calls a scrit method in the right moment that uses transform.SetParent() to change the parent of the item from human A's hand to human B's hand. This would teleport the item from one human to the other.
  3. If you want a complex but more realistic behavior, where the hands actually meet no matter how the humans stand relative to each other, you would need to use runtime IK (e.g. Unity's animation rigging or FinalIK from the asset store). Unless this is THE core mechanic in your game, I wouldn't go so far though.

Please let me know in case you have any follow-up questions.

Best regards,
Peter