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!