Best way of resizing an obj that's appearing too large by default?

I’m still new to WebGL and Three.js (as in yesterday). Thanks to help on this forum, I have a .obj file showing, but the scale is too large. After a bit of research I’ve tried setting THREE.Vector3( 0.5, 0.5, 0.5 ); (fine, but not sure how or where to apply this) and .scale.set( .5, .5, .5 ); on my OBJLoader (“Cannot read property ‘set’ of undefined”) and altering camera.fov; (no effect).

The code is on GitHub, with the commented-out code mentioned above in the js here (lines 20, 59-78). It’s mostly from this tutorial.

FYI this is one from a series of photogrammetry scans of archaeological and historical artefacts, generated some time ago as .obj files by 3DSOM Pro.

Hi!
You’re trying to apply scaling to the loader, whereas you have to apply it to the loaded object:

objLoader.load('56-obj.obj', function (object) {
      // objLoader.scale.set( .5, .5, .5 );
      object.scale.setScalar(0.5);
      scene.add(object);
});
2 Likes

Yep, thanks, that’s it :slight_smile:

I had tried object.scale.set( .5, .5, .5 ); but that threw an error, so I resorted to hacking in ignorance.

I had to go down to 0.01 to show something sensible. Not the best example of the photogrammetry scans I did back then (about 10 years ago), but now I can get on with refining the code to show the others (mostly Roman) and possibly make a module for the shared parts of the code, which I kind of did for the Flash-delivered version back then. Shudder.