Can imported model's child be scaled individually?

Hey, I’m having some trouble scaling a child mesh. Details are:

  • I imported some fbx models into blender, made a small scene and exported it as a single gltf
  • Loaded the scene gltf into threejs
  • Using getObjectByName I found a child of the scene
  • Then tried to scale it

The scale property of the child mesh was changed to my new value, but does not appear any different.

Is what I’m tying possible - can child meshes of imported models be scaled individually?

The steps you’re describing should work, perhaps unless the object is a THREE.SkinnedMesh. In that case the scale is bound to the skeleton. If it’s not a SkinnedMesh, and still not working, it might be helpful to see a demo or the model.

Thanks for replying so quickly!

I haven’t made it into a skinned mesh - just using the gltf loader and throwing the loaded gltf.scene into a map of THREE.Object3D to later put in the scene.

Repo:

Loader:

Usage:

Anything there look dubious?

Some follow up information:

  • When I load the gltf, I’m traversing the children in order to cast/receive shadows.
  • There, I find a match by name on the child and set the scale, which works.
  • I then put a ref to that child mesh into my map of loaded object3ds
  • Later, when I get that from the map and change the scale - nothing affects it
gltfLoader.load(sceneUrl, (gltf) => {
     // Traverse the gltf scene
     gltf.scene.traverse((child) => {
       const node = child as THREE.Mesh;
       if (node.isMesh) {
         // Shadows
         node.castShadow = true;
         node.receiveShadow = true;
       }

       if (node.name === "SM_Prop_Candle_Flame_01") {
         this.models.set("sconce-left-flame", node);
         node.scale.y = 20; // <-- This works
       }
     });
});

Later:

    const sconceLeftFlame =
      this.gameLoader.modelLoader.get("sconce-left-flame");
    if (sconceLeftFlame) {
      sconceLeftFlame.scale.y = 1;
      // This reads '1' for scale.y, but it still appears stretched in the scene 
      console.log("flame", sconceLeftFlame.scale);
}

I feel like I’m missing something obvious here. I could just import the items I want to scale individually, but I’d rather not do that since it’s a lot of extra work for the number of items I’ll need to interact with.

Is it possible you have animation playing that might override the object’s scale?

None, and to be certain I made sure to untick all the animation/skinning options when exporting from blender.

It’s totally weird - esp that I can scale when traversing but not later.

This may or may not be useful, but I noticed that when scaling on the y, it actually appears to scale on the x axis in three. This might be a side effect of coming from blender where z is up though.