so i have my character, and i’d like to use the animation retargeting features of the humanoid rig since i’ll be making more characters in future.
the humanoid rig doesn’t support translation in animation, but i need it. Not for any of the standard humanoid bones, but for one of my additional ones, the weapon bone. i need it to be able to translate relative to the hand, and i really want to still use the humanoid rig. So give me suggestions.
As it stands, i see two possible ways forward:
I import the weapon seperately with a generic avatar isntead of humanoid. then give it a second instance of the character’s animator, and put the generic avatar on that. I’m not fond of this solution, it sounds like performance might be an issue.
I read the position values from the animation clip by script, and set the offset of the weapon (or ideally the weapon bone) every frame to match. I like the sound of this for the sake of transparency, but is it possible?
So questions:
Is option 2 possible? Is that translation data still kept and imported in the animation file, even though its not used?
are there any other possible methods that might accomplish my needs?
Hey, Ive been through similar problems with the humanoid rig and using props and weapons. I went with a very simplistic approach in the end
I can tell you that when you are using a humanoid avatar you can have ‘additional’ bones ( bones that are outside of the avatar template and that are not ‘in between’ avatar bones) in the rig then these will support translation.
Humanoid Avatar bones except the hips don’t support translation.
So you can have an additional bone this can just be an empty object in your 3d package as a child of the wrist for example.
You can parent a prop/weapon model to it in your 3d package for reference and then animate this additional bone.
Export out the animation including the additional bone animations to fbx and when you import into using making sure to have additional bones ticked and no masking applied in the individual fbx clips.
The weapon mesh can be added to the appropriate bone manually by parenting it under the character prefab hierarchy or through a script.
This will allow the weapon/ prop to animate freely so if you wanted to animate change of grip or move the prop independent of the hand you can animate this bone to achieve that. This works well form most character animations.
There are some issues with this method however which I cant solve:
Re targeting animation can be a bit messy doing this as the humanoid bones will re target well but the additional joints don’t get processed the same well and will just rely on the translation and rotation values in the original animation clip.
if all the characters hands are identical it wont be noticeable but if there’s a big size shape difference it wont look good.
If a characters holding a weapon/ prop with two hands and you re target you will probably need to look into using the ik features to pin the hand to the correct location as it will most likely be off.
Also be wary of moving the weapon too far way from the wrist, stuff like holstering can be a problem because of this.
Id love to know if there are ways around these issues as it makes using weapons with a humanoid rig really frustrating.
As far as i know you cant. its a pain. You have to do it for every animation clip.
A few versions of unity ago i had an issue where the additional bones in the masking settings you have an image of above were ticked on by default on import. but the additional bones did not animate. I had to turn them off, hit apply and then turn them on again to force them to work. ( Just a warning in case this happens to you, but they may have fixed this recently)
Here is how I do it: I export one animation at a time from Blender, tick the boxes, change lengt etc. Then I rip the animation out of fbx using CTRL+D and put it in animations folder. Then I export next animation on top of the old fbx file, ticked boxes remains ticked. Then I adjust the lenght of the animation if nessecary. You need to use 6.1 exporter in Blender for this to work, because 7.4 adds “|” to the animation name, which prevents duplicating in Unity:
haha. wow, never realized you can just ctrl+d… and it makes the file a .anim file and removes the fbx read-only problem. Well thank you. learned something new!!
Its explained in the gif. 7.4 exporter adds “|” character to the animation name. Its forbidden character in Unity. Its more Blender problem than Unity problem. My method is pain when you want to iterate animations. Importing animations in Unity is hellish click fest in any case.