Object constrained to parent is Ok in editing but not on export
Hi,
I have an object I constrain to my players hand. When I am building the animation, it's fine and in a good position.
When I export and use it in came on the same character prefab, the item I constrain isn't in the hand but a little way off. Any ideas?
Working (in editor): https://www.loom.com/share/1fbdb55738cc47ed8625c10199e4be89
On export and attach to the player:
Answer
I have just noticed as well that the head animations haven't come across so something is off.
Also, if I pause play mode and run the animation in editor, it works fine as well.
Also, I'm exporting a .anim and it's humanoid.
I seem to have fixed the offset issue by moving my object to the hips from the leg. Works for me.
Head is still static though.
Hi,
thank you very much for your support request.
The child-of constraint calculates the position/rotation of the object as if it would have changed the parent, but in reality it does not change the parent. So what you get is a curve that is still in local space of the original parent. If you now export your animation, and the final animation is played a little bit different than the original (for humanoid, there are several reasons why this can happen like bad humanoid avatar setup, wrong root motion settings,...) then the offset doesn't match anymore.
An easy fix is to use generic, as it plays the animation "as it is". No humanoid "black magic" involved. It's less complicated then humanoid (in usage) and has better performance (due to no animation re-targeting) and better quality (humanoid's animation re-targeting is a lossy process that is always sacrificing quality a bit). The only benefit of humanoid is it's ability to use the same animation across different (humanoid) characters (which won't work anyway when you are using the child-of constraint). You can convert your animations to generic by creating a new UMotion project of type generic and import the humanoid project. That's what I would strongly recommend.
More information on humanoid: https://blogs.unity3d.com/2014/05/26/mecanim-humanoids/
Head is still static though.
There might be an issue with your humanoid setup. Check the humanoid configuration (rig tab of the inspector of your source model). Check that all bones are displayed in green. Changing the humanoid setup might require an update of your UMotion project (i.e. create a new humanoid project, assign the new character and then import the old project to keep all the animations you've made).
Another thing you can check: Select the exported *.anim and check the preview window in the inspector (it uses unity's default humanoid character as preview). Does the head preview correctly?
Best regards,
Peter
Thanks for your detailed response. The generic solution does seem logical in my case as I am only going to be using this animation on this character. Thanks.
RE: Head moving.
It's currently working fine when I preview the animation in unity. It even works if I don't use the default humanoid and select my own. It's only during play in which it doesn't work
RE: Head moving.
It's currently working fine when I preview the animation in unity. It even works if I don't use the default humanoid and select my own. It's only during play in which it doesn't work
That means that the exported animation is working correctly and the issue is related to your character instance. Maybe you are using an avatar mask in your animator controller, or some scripts that override the head transforms. You might want to try it with a fresh instance of your character (instantiated directly from the source *.fbx file). If it works there, compare it with the settings of your old character instance.
Best regards,
Peter
Customer support service by UserEcho
Hi,
thank you very much for your support request.
The child-of constraint calculates the position/rotation of the object as if it would have changed the parent, but in reality it does not change the parent. So what you get is a curve that is still in local space of the original parent. If you now export your animation, and the final animation is played a little bit different than the original (for humanoid, there are several reasons why this can happen like bad humanoid avatar setup, wrong root motion settings,...) then the offset doesn't match anymore.
An easy fix is to use generic, as it plays the animation "as it is". No humanoid "black magic" involved. It's less complicated then humanoid (in usage) and has better performance (due to no animation re-targeting) and better quality (humanoid's animation re-targeting is a lossy process that is always sacrificing quality a bit). The only benefit of humanoid is it's ability to use the same animation across different (humanoid) characters (which won't work anyway when you are using the child-of constraint). You can convert your animations to generic by creating a new UMotion project of type generic and import the humanoid project. That's what I would strongly recommend.
More information on humanoid: https://blogs.unity3d.com/2014/05/26/mecanim-humanoids/
There might be an issue with your humanoid setup. Check the humanoid configuration (rig tab of the inspector of your source model). Check that all bones are displayed in green. Changing the humanoid setup might require an update of your UMotion project (i.e. create a new humanoid project, assign the new character and then import the old project to keep all the animations you've made).
Another thing you can check: Select the exported *.anim and check the preview window in the inspector (it uses unity's default humanoid character as preview). Does the head preview correctly?
Best regards,
Peter