Gltf model goes wrong with shadow

Hey guys. I was trying to load my GLTF model made up by Blender in my three.js
I used the following code

                loader.load( 'island.gltf', function ( gltf ) {
                    scene.add(gltf.scene);
                } );

it worked like this, it looks ok.

but then I wish to make it cast a shadow,
so I use the following code

				loader.load( 'island.gltf', function ( gltf ) {
					gltf.scene.traverse( function( node ) {
					if ( node.isMesh ) { 
						node.position.set(0,10,0);
						node.castShadow = true;
						node.reseiveShadow = true;
						}
					} );
					scene.add(gltf.scene);
				} );

It does cast a shadow, but the model itself just move apart like this


I am wondering to know how to fix this problem?
Thank you!

that is your problem

1 Like

It seems your model consists of multiple individual objects which are grouped together in form of a hierarchy. With the above code, you translate all of these objects.

I assume you just want to move the model up so do this instead:

gltf.scene.position.set(0,10,0);
1 Like

Thank you!

Thank you, I solved it!