C11R11
August 19, 2020, 6:47pm
1
Hi there!
I’m trying to move the camera to a glb file I can’t
var helper = new THREE.BoxHelper(objectLoad.children[0]);
helper.geometry.computeBoundingBox();
camera.position.z = helper.geometry.boundingBox.max.z + 100;
camera.position.y = helper.geometry.boundingBox.max.y + 100;
camera.position.x = helper.geometry.boundingBox.max.x + 100;
scene.add(helper);
....
theclass.camera.lookAt(helper.geometry.boundingBox.max);
With that, and the object added to the scene will be enough to see it or not? I can see the bounding box, but not the object
Note: If I make an object.center() to the model I can see it, but I wanted it on the original position
Thanks in advancemodel.glb (72.7 KB)
If it helps, I do something like this in my viewer:
C11R11
August 19, 2020, 7:12pm
3
Thanks! I will take a look into it.
BTW, is there a standard to define the this objects?
Because in the threejs documentation says one way to extract the data
loader.load('foo.gltf', function ( gltf ) {
var scene = gltf.scene;
var mesh = scene.children[ 3 ];
var fooExtension = mesh.userData.gltfExtensions.EXT_foo;
gltf.parser.getDependency( 'bufferView', fooExtension.bufferView )
.then( function ( fooBuffer ) { ... } );
} );
But the model I have don’t have the same info.
Cheers
I’m not sure what you’re trying to do, sorry. The example accessing .userData
is showing how to access very customized data, if you know that you’ve put custom extensions into the file already. If not, you should use the first example on the docs instead.
https://threejs.org/docs/#examples/en/loaders/GLTFLoader
C11R11
August 19, 2020, 9:10pm
5
I’m getting closer now with your code.
Thanks!