I’m practicing a third person demo recent days, and I really wonder how to make character mesh and weapon mesh interact together like reload or check the weapon.
So I decide to copy mannequin’s skeleton to my weapon mesh, look at the picture below:
(I attached the root bone of the pistol to the character’s bone named ‘hand_r’, so the bones in my weapon will be a set of extra bone in character’s skeleton)
By doing this, I can play the same animation on two skeletons, and they will perform together well.
(2 Skeletons playing same animation)
It’s easy to remind us to use node ‘Copy Pose from Mesh’ to copy parent mesh’s animation to our weapon, but it seems doesn’t work.
(seems the weapon wasn’t animated)
the offical page says the node only copies bones in hierarchy, so from my perspective, when we play an animation with extra bones on character’s mesh, the engine won’t calculate those extra bones to improve performance, thus the weapon mesh won’t act as my think.
So how to solve this problem?
Even ‘Set Leader Pose Component’ got this issue too.
My solutation is to exchange weapon mesh and character mesh(make character mesh copy weapon mesh’s animation), so the animation will be played on a skeleton that has extra bones.
i feel bad with such a method, really R.I.P.
Hello @INTERESTING_2016, both the Copy Pose From Mesh and Set Leader Pose Component should be working properly…
How did you position the pistol in the skeleton hierarchy before exporting from Maya? Is it located in the root bone of the character like the first image? If yes, you have to move the pistol root bone to the correct position related to the hand, otherwise it will keep that offset (from the hand_r to the root) when copying the animation data (like it appears in the second image).
Regarding the extra bones, you’re correct, only the bones existing in the parent will be copied, but it should be enough for the pistol to be correctly attached to the hand.
If moving the pistol root bone to the correct position related to the hand bone doesn’t work, could you share a screenshot of your skeleton hierarchy, the position of the pistol root bone, and your current ABP and BP set up?
Thank you @brs-ianferrari .
Yes, the position of pistol is as you said, here’s the screenshot of pistol’s skeleton hierarchy in maya.
From ‘root’ to ‘weapon_r’, it’s all original skeleton of mannequin, I just added ‘weapon_root’ and 3 bones below to make animation:
Yes, move the position of pistol to the hand can make it looks well, but my key point isn’t there: Take a look at image below, I’ve made an idle animation for the pistol and its position is well, I can even play this animation using two skeletal meshes, they worked very well, so the position isn’t the key point, but rather the node ‘Copy Pose From Mesh’ cannot copy bones which do not exist in its mesh.
And the ABP setup, I just connected it with a ‘Copy Pose From Mesh’ and checked the property ‘Use Attached Parent’, see images below:
Here’s the source file, feel free to test it using Mannequins’s skeleton: [Source Files].(Microsoft OneDrive)
Thanks for all the information @INTERESTING_2016!
I think I understand what you’re trying to achieve… Indeed, I don’t think you can sync bones that do not exist in the parent, but you can still use the Copy Pose From Mesh to make sure the weapon follows properly the hand bone. To do that, you need to position the root bone of the weapon in the proper position before exporting the skeleton.
Right now, I can see the weapon root bone is located in the 0,0,0, meaning it will always keep the offset is has from the hand_r bone. If you open the pistol skeleton, you will see the transform values in the Details panel:
You want it to look more or less like this, so it’s properly positioned when it’s attached to the parent without any extra animation:
To play the shooting animation, I’d suggest you play an Animation Montage for both the player - using the player shoot animation -, and the weapon - using the pistol shoot animation. That way you will trigger the correct animation for both skeletons at the same time.
If you do both those things, the pistol should be always properly attached to the hand, and when you need the pistol to play an animation, you can play a Montage.
Please let me know if that’s clear and if it works for you!