Trouble changing position of an imported model

I’m having trouble moving an imported model. I’m following the example from Discoverthreejs. When I change the position of any of the bird models, they move fine. However, I’ve added my own giant (and poor) flower model, generated in Blender. For some reason, regardless of the values I have in line 101 of app.js, the flower never changes position. Can anyone explain why?


live version

Use this code for position your model:

loader.load( 'models/flower01.glb', ( gltf ) => {

	gltf.scene.position.set( 0, -3, -10 );
	scene.add( gltf.scene );

}, onProgress, onError );

The problem is that the existing onLoad() function does something which is not valid for all models. It assumes that the asset only consists of a single mesh object. Thus the following code works:

const model = gltf.scene.children[ 0 ];

But this approach fails if the asset is represented by more than a single mesh (which is actually quite common and true for your flower). Hence, this should be your preferred approach:

const model = gltf.scene;
1 Like

Thanks for your help Mugen87. That worked, and I understand the reason better as well. Nice answer!

1 Like