How can I put a weapon in my character's hands?

Hey, guys. I just cannot seem to find any tutorial or step-by-step thing on how to do this. I have a 3rd person character model and I want to put a sword in his hand and see it animate while previewing Mixamo animations and such, to make sure it’s positioned correctly and such. My problem is I do not know how to do this. I know it has something to do with parenting the weapon to the arm/hand or something along those lines, but could someone give me a tip or a video showcasing what I want to do? Thank you!

Friendly Bump. I’d really like to know how to do this. *If it’s any more important information, the weapon is going to be permanently attached to the hand. I don’t want a sheathe or a ‘switch weapons’ function or anything like that. I just want a weapon to stick to my player model’s hand.

You can link you weapon to the hand bone
weapon.transform.parent = [hand bone object].transform
weapon.transform.localPosition = Vector3.zero

Then adjust the eulerangle to match hand mesh

I tried doing this and for whatever reason it didn’t work. I tried making it a script, but no matter what I did it gave me an error. >:( LOL. This should be SO simple, but seriously! It takes me 2+ days to stick a damn sword in my characters hands??? Oh, well… I guess Unity game-making isn’t as easy as people claim. Any other ideas? I tried putting a combinechildren script on my hand, but that didn’t work either, assuming it even could’ve.

I don’t know who’s claiming it’s easy. It’s a programming language and editor, it’s not a “game maker”. Combine Children is nothing to do with this. All gameobjects have something called a transform, and this transform can be made to be a parent or a child. You simply drag the sword as a child of the hand and it will work.

To do this process in code you use weaponObject.transform.parent = hand.transform; Assuming you change the names, this will cause the sword to be a child of the hand. You should look this stuff up and get a clearer idea. The above poster is saying the same thing as I am.

1 Like

Do as hippocoder says, or just add an empty gameobject and attach it as a child of the hand and rotate the transform as you need it, then in code attach the weapon to the empty gameobject. This will allow you to move the weapon exactly how you want it and change the weapon easily in code.

show your code, some one may easy to help you.
link the weapon to hand point is the easiest way to do

OK, I actually figured out why I couldn’t see it. I just needed to get an animation clip playing, because, for whatever reason, the Mixamo Asset Store doesn’t want me testing it out with the weapon in hand. However, moving the sword in the hierarchy worked like a charm! Now, I only have one small problem. It’s not huge as the game is FAR from complete and I’m literally just diving into the first percent. But, I moved my character closer into the terrain so I could see what it looked like on the ground instead of the air. But, when I go back into game view to see him animate, he teleports back to his original spot in the air (0,0,0). He goes back on the ground, though, when I step back into scene view. Does this happen for anyone else?

Lol all u had to do was move the model where u wanted it and moved it into the player model in the hierarchy.

even with transform you may find that it doesnt work. What you really need is an animation that is similar to the pose you want then using unity IK modify a transform to position and lock the hands to where you want them. So when you transition between animations the hands are always in the right spot. When you need to stop the hands being locked simply set the IK weight to 0.

Make sure you set in mechanim IK pass set to true.

I’m a Necromancer. Deel with it :slight_smile:

Edit: Miss Read the Q

Find the hand bone in rig. Child Weapon to hand bone. Done

No,…Seriously, Deel with my Necro Powers .

1 Like

there is no child object for hand in my 3d model.i downloaded 3d character from mixamo.i want to create animation for a person picking a object on table.i got similar animation on mixamo but how can i attach object with animation there is no child object for hand in my 3d model.any help on this will be highly appreciated

I could but I won’t, so there! Oh alright then :frowning: