Answered

scale for squash and stretch

hassancharafeddine87 5 years ago updated 5 years ago 8

How do I use the scale tool to make squash and stretch on humanoid characters, for punching for example?

UMotion Version:
1.02
Unity Version:
2019.3

Answer

Answer
Answered

Hi,
thank you very much for your support request.

Unity's humanoid animation system abstracts the humanoid anatomy so that an animation initially created for humanoid A can be played on any other humanoid character (i.e. animation re-targeting). This abstraction adds limitations like not being able to scale bones.

I recommend using "generic" instead of "humanoid", that way you get back all degrees of freedom for each bone of your character (rotation, translation and scale). If you need to convert some of your animations from humanoid (e.g. mocap animations not initially created for your specific character) to generic, import them into your humanoid UMotion project (before you switch to generic) and then export the animations to *.FBX. Then change the animations and your character to "generic" (in the Inspector of those files).

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

Best regards,
Peter

GOOD, I'M SATISFIED
Satisfaction mark by hassancharafeddine87 5 years ago
Answer
Answered

Hi,
thank you very much for your support request.

Unity's humanoid animation system abstracts the humanoid anatomy so that an animation initially created for humanoid A can be played on any other humanoid character (i.e. animation re-targeting). This abstraction adds limitations like not being able to scale bones.

I recommend using "generic" instead of "humanoid", that way you get back all degrees of freedom for each bone of your character (rotation, translation and scale). If you need to convert some of your animations from humanoid (e.g. mocap animations not initially created for your specific character) to generic, import them into your humanoid UMotion project (before you switch to generic) and then export the animations to *.FBX. Then change the animations and your character to "generic" (in the Inspector of those files).

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

Best regards,
Peter

thank you the reply, one more question, I have to use the rig that was created with that animation if it was generic as a gameobject right? I'm using mixamo bots as reference to edit my animations since like you said humanoids accepts all rigs, but is there a way for generic animations to accept other rigs?

Hello again everything works like you said however when I want to export the project of type generic it only works as an anim file if I try to export as an fbx the animation is weird it wont work, its no big deal, but I have more control if it was an fbx, maybe you converter plugin solves this? also there are no tool assistant on the generic project for the hands and the lower and upper body i mean

Btw I forgot to mention I do want my animation to be humanoid because I want to retarget it to another model

"I'm using mixamo bots as reference to edit my animations since like you said humanoids accepts all rigs, but is there a way for generic animations to accept other rigs?"

Animation re-targeting only works for characters configured as humanoid. That advantage comes with limitations (e.g. scaling of bones not being supported,...). If you want to use some humanoid animations on your generic character, configure it as humanoid, then import the humanoid animations into your humanoid UMotion project. Then export the animation to *.FBX. Then configure everything to "generic" and now you can use that animation on your generic character.

"Hello again everything works like you said however when I want to export the project of type generic it only works as an anim file if I try to export as an fbx the animation is weird it wont work, its no big deal, but I have more control if it was an fbx, maybe you converter plugin solves this?"

Export to generic is expected to work fine. Make sure that your  *.FBX is configured as generic and that you play it on the same generic model as you created the animation for. If you want to configure your *.FBX as "humanoid", I recommend exporting the animation into the *.FBX of your character. You can do that by setting the "Write Mode" to "Update Existing File" (in the UMotion settings). Then select your character's *.FBX as destination file. This ensures that the correct humanoid avatar is used.


"Btw I forgot to mention I do want my animation to be humanoid because I want to retarget it to another model"

When you create your animation as generic (with scaling applied to the arm bones) and export it to *.FBX, than configure the *.FBX to humanoid all your scaling would be lost (as humanoid just does not support scaling bones). In other words, animation re-targeting with scaling applied to bones is not possible in Unity.

Best regards,
Peter

ok fair enough, then just curious here how do I add stretch and squash to a humanoid character? or that's will not be possible unless I have my own generic rig with its own generic animations? in other words each rig comes with its animations? is that an industry standard thing?

You could write a script that adds this effect. Use LateUpdate() to execute the functionality after the Animator. You can setup a UMotion callback to trigger the script from within UMotion and use a "Custom Property" in "Component Property" add an animation curve to your animation that is controlling the script(s) input parameter.


// Assign this component to a bone you would like to scale

public class ScaleComponent : MonoBehaviour

{

   // Animate these properties via a "Custom Property Constraint" from within UMotion

   public float ScaleX = 1f;

  public float ScaleY = 1f;

  public float ScaleZ = 1f;

   public void LateUpdate()

   {

      transform.localScale = new Vector3(ScaleX, ScaleY, ScaleZ);

   }

}


Please check out the manual at "Pose Editor/Constraint System/Custom Property Constraint" to learn how to access the scale properties from within your animation in UMotion.

This is how you call "LateUpdate()" from within UMotion (to preview the effect of your script):

Best regards,
Peter

that's exactly what I was looking for thank you so much