1
\$\begingroup\$

Look at this picture first: enter image description here

I have model that has sword in his hand. I added a cube named "Attack Collision" and located to blade position. And then set the hand to parent.

But when the game starts, sword moves but it's children "Attack Collision" doesn't move at all.

The funny thing is in the scene, I tried to move the "sword", but only it's children "Attack Collision" was moved.

Seems like the sword is somekind of locked, because it's transform can be change but not applied at all, it's just stand still there and only it's children that made from Unity was moved like this: enter image description here enter image description here

I made this model and animation by Blender and imported to Unity as .FBX file.

What am I missing?

\$\endgroup\$
  • \$\begingroup\$ Does your Sword object contain a Rigidbody component? \$\endgroup\$ – Tolga Şen Jun 4 '17 at 9:44
  • \$\begingroup\$ Can you show us the contents of the metarig object? Unity treats the skeleton of the object (which transforms rigidly) and the skinned mesh (which displaces vertices in a smoothly blended way) separately. So for following the animation of a particular bone rigidly you may need to parent your object to the bone, rather than to the display mesh. \$\endgroup\$ – DMGregory Jun 4 '17 at 9:58
  • \$\begingroup\$ @TolgaŞen No, it's just GameObject that has SkinnedMeshRenderer and shaders. Unity automatically converted when it's imported. \$\endgroup\$ – modernator Jun 4 '17 at 10:23
  • \$\begingroup\$ @DMGregory Yes, inside of metarig object, it contains lots of empty GameObjects. And inside of each GameObject, it has same name that I was set on Blender(modeling program). This is screenshot that I just took it: photon.modernator.me:/album/rico345100@gmail.com/others/unity/… \$\endgroup\$ – modernator Jun 4 '17 at 10:28
  • \$\begingroup\$ I guess it is not about childing it whether to the hand or the root transform of the character. I mean these two will be different but in both cases, the Attack Collision object must move with the body somehow. Can you try the same approach with ethan and tell us if it is working or not? (Ethan: The Standard First Person Character Prefab which Unity provides with the standard assets) \$\endgroup\$ – Tolga Şen Jun 4 '17 at 14:42
1
\$\begingroup\$

Finally I solved! It's quite surprising how easy to make it. The simplest way to solve this problem is attach Attack Collistion GameObject into the bone(armature), not a actual weapon.

I accidently saw the animations were made from Blender into Unity by Animation tab and saw every rotation were only applied to bones.

So I added a Attack Collistion object and child to that bone(weapon), it's perfectly working.

\$\endgroup\$
  • 1
    \$\begingroup\$ "Finally I solved" - isn't this what I suggested you try investigating a week ago? "parent your object to the bone, rather than to the display mesh" ;) I'm glad you got it working, it just seems like you could have had it working a lot earlier if you'd read the whole comment... \$\endgroup\$ – DMGregory Jun 11 '17 at 14:50
  • \$\begingroup\$ @DMGregory Looks like I didn't understood what you were told me because of my bad English and lacks of Unity knowledge. Like you said it could be shorter, totally agree. Thanks for advice. \$\endgroup\$ – modernator Jun 12 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.