Hi,
I have been trying to place a marker on glb scene.
After much googling I managed to place the marker. But it is completely out of place.
If you rotate the model you will find a smile floating around. The point is to put it, let’s say, in one of the eyes of the model.
But I just can’t find the coordinates. How can I calculate them.
I made a codepen so you can see what I mean.
Thanks
makc3d
2
loader.load( 'https://glcdn.githack.com/arrisco/portoeditora-gltf/-/raw/master/modelos/fossil/scene.glb', function ( gltf ) {
gltf.scene.scale.set(0.03,0.03,0.03) // scale here
scene.add(gltf.scene);
const model = gltf.scene.children[0];
model.scale.multiplyScalar(0.1)
model.position.y = - 1.6;
scene.add(model); // actually a light ?
gltf.scene.updateMatrixWorld(true);
scene.add( new THREE.BoxHelper( gltf.scene, 0xff0000 ) );
const box = new THREE.Box3;
box.setFromObject(gltf.scene);
createMarker(scene, box.min);
animate();
} );
however, there is something invisible in your gltf that doubles the bounding box:
Thanks alot makc3d.
The model thing was actually a light and made no sense.
I have experimented so much that part of the code stayed there after my clean up.
I will try to find my way from your help.
Again thanks alot.