Not a bug

Optimize Game Objects bug

Anonymous 4 years ago updated 4 years ago 4

Hello, I am currently animating an archer. The archer is using generic animations and has "Optimize Game Objects" enabled in the importer, the Hands are exposed though, so I can add weapons.

When I add a bow as a child of the hand, that is also rigged, and then try to animate the character in UMotion, including the bow, the bows skinned object (not the container/parent) somehow is now located at the root of the character instead of the hand, hierachy and position wise. If the character is not optimized, it works and the bow stays in the hand.


This isn't a huge problem, but I still have to disable optimization every time I animate, which is not the best workflow.

Maybe a reason could be that both, the character and bows first child is called "Armature"?

UMotion Version:
1.25p02
Unity Version:
2020.3.8f

Answer

Answer
Not a bug

Thanks for sending me the example project. It was very well structured and made it easy for me to investigate, thanks for that.


From your email:

I think this could be related to the bow having the bones parent called "Armature" as well (Which also gives a warning). I sadly can't change the name, as blender does this automatically for rigs.

Yes that's exactly what's causing the issue. The de-optimize method thinks that the bow's "armature" is the same as the "armature" of your character. Thus the de-optimized setup ends up with a different rig hierarchy (where the bow is a child of the character's "armature" bone instead of the "Wrist1" bone).

Unfortunately this isn't something that I can fix in UMotion's code as this problem is coming from within a Unity API method called AnimatorUtility.DeoptimizeTransformHierarchy(). Luckily the fix for you is rather easy, just rename the "armature" bone of the bow to something unique (e.g. "armature_bow"). You can do this in your prefab in Unity, no need to do this in Blender.


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


Best regards,
Peter

Under review

Hi,
thank you very much for your bug report. I appreciate your time and effort to help me improve UMotion.

May I ask you to send me a small reproduction project (i.e. an empty Unity project that includes your character + bow setup instantiated in the scene, plus a corresponding UMotion project file) so that I can reproduce your exact situation? That would make it much easier for me to provide a tailored solution. If you want, you can send the character without textures. Please send it to me via the email support form (or if the file size is too big, request a link to my dropbox via said email form).

Thank you very much.

Best regards,
Peter

Thank you, I sent you an email!

Answer
Not a bug

Thanks for sending me the example project. It was very well structured and made it easy for me to investigate, thanks for that.


From your email:

I think this could be related to the bow having the bones parent called "Armature" as well (Which also gives a warning). I sadly can't change the name, as blender does this automatically for rigs.

Yes that's exactly what's causing the issue. The de-optimize method thinks that the bow's "armature" is the same as the "armature" of your character. Thus the de-optimized setup ends up with a different rig hierarchy (where the bow is a child of the character's "armature" bone instead of the "Wrist1" bone).

Unfortunately this isn't something that I can fix in UMotion's code as this problem is coming from within a Unity API method called AnimatorUtility.DeoptimizeTransformHierarchy(). Luckily the fix for you is rather easy, just rename the "armature" bone of the bow to something unique (e.g. "armature_bow"). You can do this in your prefab in Unity, no need to do this in Blender.


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


Best regards,
Peter

Thank you for your excellent support, I will do that!