I have 3 different 3D Models with different scale. Each model is assigned to a button and the model gets instantiated when the button is clicked. How do I avoid models getting instantiated with different size/scale.
You could get the bounding box of all 3 models, then compare their size with
var box = new THREE.Box3(); var size1 = new THREE.Vector3() var size2 = new THREE.Vector3() var size3 = new THREE.Vector3() box.setFromObject(obj1).getSize(size1); box.setFromObject(obj2).getSize(size2); box.setFromObject(obj3).getSize(size3); // Now access .x, .y, .z to get width, height or depth. console.log(size1.x); console.log(size2.x);
Once you know their width, depth, or height, you could compare their dimensions and scale them down. It’s up to you to determine if you want to compare by width, depth or height.
Thanks for your help, it’s working!