[OPEN SOURCE] Multiplayer 3D RPG Using Colyseus

Hi there,

I’m trying to attach a sword to a bone of my character but it is acting a little weird? Is my logic flawed? The video shows what i mean very clearly.

// load player mesh
const result = this._loadedAssets["RACE_" + this._entity.race].instantiateModelsToScene();
const playerMesh = result.rootNodes[0];
this._animationGroups = result.animationGroups;
this._skeleton = result.skeletons[0];
   
/////////////////////////////
// equip weapon
if (this._entity.type === "player") {
  let bone = this._skeleton.bones[34];
  const weapon = this._loadedAssets["ITEM_sword_01"].instantiateModelsToScene();
  const weaponMesh = weapon.rootNodes[0];
  weaponMesh.setParent(bone);
}

/////////////////////////////////////////////////

As a bonus, had a funny bug earlier on :slight_smile:

He’s in big trouble