# Adding weapon to character hand

**URL:** <https://discourse.threejs.org/t/adding-weapon-to-character-hand/30702>\
**Category:** Questions\
**Tags:** skinned-mesh\
**Created:** [October 11, 2021, 5:53am UTC](https://discourse.threejs.org/t/adding-weapon-to-character-hand/30702 "2021-10-11T05:53:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0x88](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/0x88/32/20992_2.png) [@0x88](https://discourse.threejs.org/u/0x88)\
**Post date:** [October 11, 2021, 5:53am UTC](https://discourse.threejs.org/t/adding-weapon-to-character-hand/30702/1 "2021-10-11T05:53:00Z")

</div>

I want to add a gun to my character’s right hand, however, I don’t see that gun anywhere near the character. I tried adding the gun group as a child to the hand, and then setting the parent of the gun to that hand. It didn’t work. How do you add a weapon to my character’s hand? If it helps, my character is a mixamo character.

```javascript
fbxLoader.load("soldier.fbx", function (fbx) {
  fbx.scale.setScalar(0.01);
  let playerBox = new THREE.Box3().setFromObject(fbx);
  scene.add(fbx);
  const playerSize = new THREE.Vector3();
  playerBox.getSize(playerSize);
  const playerGeometry = new THREE.BoxGeometry(playerSize.x, playerSize.y, playerSize.z);
  const playerMesh = new THREE.Mesh(playerGeometry);

  fbxLoader.load("pistol.fbx", async function (fbxPistol) {
    fbxPistol.scale.setScalar(0.01);
    const rightHand = fbx.getObjectByName("mixamorigRightHand");
    rightHand.children.push(fbxPistol); 
    fbxPistol.parent = rightHand;
    console.log(fbx);
  }
}

```

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [October 11, 2021, 8:05am UTC](https://discourse.threejs.org/t/adding-weapon-to-character-hand/30702/2 "2021-10-11T08:05:16Z")

</div>

When you add a 3D model as a child to a bone, all transformations of the bone are also applied to the model. So you might have to update the model’s scaling, position and/or rotation so it appears with the correct transformation.

BTW: Don’t do this:

> [@0x88](#):
>
> ```javascript
> rightHand.children.push(fbxPistol); 
> fbxPistol.parent = rightHand;
> 
> ```

There is a dedicated method for this use case: `rightHand.add( fbxPistol );`

---

<div class="post-metadata">

**Author:** ![0x88](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/0x88/32/20992_2.png) [@0x88](https://discourse.threejs.org/u/0x88)\
**Post date:** [October 13, 2021, 5:10pm UTC](https://discourse.threejs.org/t/adding-weapon-to-character-hand/30702/3 "2021-10-13T17:10:58Z")

</div>

I tried your solution, and then attempted moving the model. After playing around with some code to get fbxPistol in a better position using fbxPosition.position=… I realised this doesn’t seem to change the position at all. Any ideas how I can apply transformations to my model that actually affect it?

---

<div class="post-metadata">

**Author:** ![Ryan\_Kang](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/ryan_kang/32/15169_2.png) [@Ryan\_Kang](https://discourse.threejs.org/u/Ryan_Kang)\
**Post date:** [November 13, 2021, 4:05am UTC](https://discourse.threejs.org/t/adding-weapon-to-character-hand/30702/4 "2021-11-13T04:05:21Z")

</div>

I was trying to load a sword in right hand but I don’t see my sword after following the implementation. Please see my code below. Could you shed some lights on this please?

```javascript
            fbxloader.load('models/fbx/guard/vanguard_t_choonyung.fbx', (fbx) => {
                actions = {};
                fbx.scale.set(0.01, 0.01, 0.01)
                fbx.position.set(0, 0, 0)
                guardMixer = new THREE.AnimationMixer(fbx)
                actions['default'] = guardMixer.clipAction(
                    fbx.animations[0]
                )

                fbx.traverse(function (object) {
                    if (object.isMesh) object.castShadow = true;
                });

                model = fbx;
                model.rotation.y = 3;

                skeleton = new THREE.SkeletonHelper(model);
                skeleton.visible = false;
                scene.add(skeleton);

                dirLight.target = model;
                fbxloader.load('models/fbx/guard/animations/Standing Idle.fbx', (fbx) => {
                    actions['idle'] = guardMixer.clipAction(
                        fbx.animations[0]
                    )
                    currentAction = 'idle';
                    activatedActions.push(currentAction);
                    actions['idle'].play();
                    fbxloader.load('models/fbx/guard/animations/Great Sword Walk.fbx', (fbx) => {
                        actions['walk'] = guardMixer.clipAction(
                            fbx.animations[0]
                        )
                        scene.add(model);
                        guardReady = true;
                    })
                })

                fbxloader.load("assets/weapons/fbx/sword/Scottish_Sword.FBX", function (fbxSword) {
                    scene.add(fbxSword);
                    fbxSword.scale.setScalar(0.015);
                    const rightHand = fbx.getObjectByName("mixamorigRightHand");
                    rightHand.add( fbxSword );
                })
            })

```
