0
$\begingroup$

I was trying to animate a character rig with a prop and got some unexpected result. The reason why I'm animating a separate prop is because what I have in mind is, in Unity, I'll turn off the prop's MeshRenderer and I'll parent whatever "real" prop that I need on that props position. Now, the animations for the rig was exported properly, with a bit of issue. But the props animation somehow got applied to the rig as well. On one of the rig's animation, the left arm did some weird thing and it didn't follow the hand properly.

I'll add my blend file here as I think it might be easier if you guys can see it yourself.

This is what the model looks in blender.

enter image description here

Here's what it looks like in Unity(the other side is alright)

enter image description here

And here's what the animation of the prop looked like in Unity

enter image description here

I've already seen this as well and I'm not quite satisfied with it's answer

UPDATE: I kinda found a workaround for that prop animation affecting the rig. What I did is I just gave the prop it's own bone so the the animation the prop needs only applies to it's own bone. Unfortunately, that weird exported forearm behavior is still there.

UPDATE:

Here's what the model's hierarchy on Unity, I already made the model humanoid:

enter image description here

UPDATE:

After following the answer below, I realized that my model can't be recognized as humanoid because Unity can't find a head bone. I think I kinda have this problem before as well

enter image description here enter image description here

$\endgroup$
10
  • $\begingroup$ Are you treating the skeleton as a Humanoid skeleton or a Generic skeleton in Unity? Can you show the bone/game object hierarchy that gets generated? Just drag the character into an empty scene, and expand its hierarchy. $\endgroup$
    – Mr A
    Commented Nov 20, 2023 at 12:43
  • $\begingroup$ Hi, sorry for the late reply. I already added a screenshot of the game object hierarchy of the model. $\endgroup$
    – rminaj
    Commented Nov 22, 2023 at 13:17
  • $\begingroup$ Can you try to make the sword bone a child of the hand bone and test if it makes a difference? For some reason, the MCH bones are getting exported as well. Can you select Only Deform Bone when exporting? $\endgroup$
    – Mr A
    Commented Nov 22, 2023 at 16:01
  • $\begingroup$ Will try later. But I didn't have that sword bone before and the main rig still have that arm issue $\endgroup$
    – rminaj
    Commented Nov 23, 2023 at 0:42
  • $\begingroup$ Yes, but when you didn't, you still had the object there which caused a bigger issue. As far as I know, Humanoid skeletons have strict requirements. Having additional bone hierarchies and extra objects just confuses the automatic process of bone mapping. That's why I am giving you suggestions to remove as many of the extra stuff as possible to make the automatic process figure out the correct mapping without manual intervention. $\endgroup$
    – Mr A
    Commented Nov 23, 2023 at 10:08

1 Answer 1

0
+50
$\begingroup$

The way that I've done this previously was to add an extra bone to the deform skeleton for the prop. Since you're using Rigify, this kind of edits will be overwritten if you regenerate the rig. That's why I suggest to do this when you are sure you won't need to regenerate the rig.

The bone you add should preferably be a child of the hand that holds the prop; however, if the prop is expected to switch hands or be mounted on the torso or back, it may be better to make it a child of the root bone. While animating, you can parent it with constraints to whichever bone makes sense depending on what you want to achieve.

The prop mesh you use in Blender will be parented to the bone just to help you visualize the bone's movement, but you won't need to export it, and you won't animate it. You will animate its bone as part of the character rig. In Unity, the animation of the bone prop may get discarded, because no mesh is skinned to it. However, I believe there is an import setting to change this behavior.

Your new mesh in Unity should be instantiated as a child under the prop bone. Make sure to pick a good default position and orientation for the prop bone to eliminate the need to adjust the position and orientation of weapon in Unity after instantiating it under the prop bone.

Your file came with a number of animations. Depending on your FBX export settings, this can lead to issues. I suggest to uncheck NLA Strips and All Actions. Since your file has many objects, I would also limit the export to Selected Objects only which will be the rig and the character only (no prop mesh as mentioned above). A screenshot is attached below.

FBX Export Settings

I believe the right arm bug was caused by a parenting issue in the bones. In my test, I baked the animation on the deform bones clearing the constraints. Then, I fixed the relationships between the bones to make the rig have a clear hierarchy. I also deleted all bones except the deform bones. The deform bones are on the third layer from the bottom right (layer 29 where the first layer is layer 0).

I am sorry if this is too much to take. Skinned assets are the hardest and trying to add complexity on top of this makes a complex mess.

$\endgroup$
7
  • $\begingroup$ Ok, that only deform bones fixed the issue I think, and not including the props as well. And maybe 4.0? $\endgroup$
    – rminaj
    Commented Nov 27, 2023 at 7:58
  • $\begingroup$ I am not sure if you mean swords in two hands or a sword that is held by two hands. For the first, you will need an extra bone on both hands. The sword in the right hand will be attached to the extra bone in the right hand. The sword in the left hand will be attached to the extra bone in the left hand. Everything else will be the same. For the second, the original setup will work fine as the weapon will follow one hand. When animating, you will typically add a constraint to parent the other hand to the weapon after placing it where you want on the weapon. $\endgroup$
    – Mr A
    Commented Nov 27, 2023 at 9:37
  • $\begingroup$ Just did some additional testing and I think your proposed process made the head disappear so Unity can't recognize the model as humanoid. I'm thinking that maybe I'll just do some ugly stuff on Unity to "animate" the swords and stuff by adding an empty GameObject to the chars hands, parenting the weapons there and coding it's rotation if needed $\endgroup$
    – rminaj
    Commented Nov 27, 2023 at 11:20
  • $\begingroup$ All the bone fields are filled in. I can't see the problem. $\endgroup$
    – Mr A
    Commented Nov 27, 2023 at 12:43
  • $\begingroup$ Except for the head unfortunately, because if you look at the other screenshot, ORG-spine003 doesn't have any other child bone left except the left/right shoulders $\endgroup$
    – rminaj
    Commented Nov 27, 2023 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .