Rotation Bug or Lack of Understanding?

Hello…either I have a lack of understanding of how my code is working or perhaps there is a bug with BabylonJS? Not really sure why…but when I set the rotation of my secondaryWeapon it causes the rotation of the primaryWeapon to be affected. But this does not occur if I manipulate scaling and position of my secondaryWeapon. Everything works as expected actually if I comment out the line that sets the rotation of the secondaryWeapon…but then the issue is I cant rotate my secondaryWeapon. EDIT: After a little more debugging i think my issue actually comes from bakeCurrentTransformIntoVertices(). Either me misunderstanding it…or a bug…not sure. Below is the main function that is causing the issue as well as the other functions that get called by the main function:

async getWeapons() {

    // use a service to get my weapons
    primaryWeapon = await this.gunService.get('m4', this.scene);
    secondaryWeapon = await this.gunService.get('m16', this.scene);

    // get the gun in a world position that is good for baking the verticies
    primaryWeapon.gunMesh.position = new Vector3(4, -6, 20);
    primaryWeapon.gunMesh.scaling = new Vector3(.25, .25, .25);

    // make new default 0,0,0 settings so that the gun can rotate 'properly' relative to the camera
    this.self.primaryWeapon.gunMesh.bakeCurrentTransformIntoVertices(); 

    // get the gun in a world position that is good for baking the verticies
    secondaryWeapon.gunMesh.position = new Vector3(0, 0, 0);
    secondaryWeapon.gunMesh.scaling = new Vector3(.02, .02, .02); 

    secondaryWeapon.gunMesh.rotation = new Vector3(0, 6, 0); 

    // make new default 0,0,0 settings so that the gun can rotate 'properly' relative to the camera
    secondaryWeapon.gunMesh.bakeCurrentTransformIntoVertices(); 
    ^^^^EDIT: THIS LINE CAUSES PRIMARY WEAPON ROTATION TO BE CHANGED^^^^^
  }

async get(name: String, scene: Scene): Promise<Gun> {
    let gun: Gun = this.guns.find(gun => gun.name == name);
    await gun.importGunMesh(scene);
    return gun;
  }

async importGunMesh(scene: Scene): Promise<Mesh> {
    this.gunMesh = (await SceneLoader.ImportMeshAsync('', this.gunMeshURL, '', scene)).meshes[0] as Mesh;
    this.gunMesh.id = this.name + 'Mesh';
    this.gunMesh.name = this.name + 'Mesh';
    return this.gunMesh;
  }

If there are no relationships (parent/child) between both guns, I don’t see how calling bakeCurrentTransformIntoVertices on one can impact the other.

However:

this.gunMesh = (await SceneLoader.ImportMeshAsync('', this.gunMeshURL, '', 
           scene)).meshes[0] as Mesh;

Are your meshes loaded from a gltf/glb file? If yes, meshes[0] is not the mesh but a transform node helper.

It is a .gltf file for the weapons. Do you think this has an impact? I thought meshes[0] was the parent mesh itself so maybe that could be causing weird issues since my assumption may be wrong

meshes[0] in a gltf file is a specific node with a special rotation / scaling to handle left vs right handed system.

You should look at the meshes array and see where the mesh you want to update really is.