You will often encounter this when loading models created in different programs and by different artists.
The model may have been created using centimeters, meters, inches, feet, or no units at all. Usually I start by scaling in factors of ten to see if it’s just cm -> m or the reverse. Trying scaling the loaded FBX object like this:
// scale down by factor of ten
object.scale.multiplyScalar(0.1);
// OR
// scale up by factor of ten
object.scale.multiplyScalar(10);
Thanks for your reply.
I’d like to know the way how to dynamically fix the scale of various FBX .
If i try to add concurrently both my SC_021.fbx and Samba Dancing.fbx with this code:
object.scale.multiplyScalar(10);
then SC_021.fbx are showed in correct, but Samba Dancing.fbx are showed in large.
Please explain me, how to dynamically controls scale of each object.
object.updateMatrixWorld();
let box = new THREE.Box3().setFromObject(object);
const size = box.getSize(new THREE.Vector3()).length();
const scalar = 1; // Change this to set the general size for each object
object.scale.set(scalar/size,scalar/size,scalar/size);
Changing the scalar value will increase/decrease the size, but all models imported should scale correctly.
The next problem is you may need to center the pivots of the models…
Good coding.
Did you test using above code with my sample fbx: SC_021.fbx
I have test your code with my sample fbx.
object.updateMatrixWorld();
let box = new THREE.Box3().setFromObject(object);
const size = box.getSize(new THREE.Vector3()).length();
const scalar = 1; // Change this to set the general size for each object
object.scale.set(scalar/size,scalar/size,scalar/size);
console.log(size); // 7085.044623234223
console.log(Math.max(scalar/size,scalar/size,scalar/size)); // 0.00014114237145672543
So, scale value is 0.00014114237145672543 and smallest.
But, three.js editor showed clearly.
How about think?
Please show me sample code with SC_021.fbx
Regards
I have detect really model body about SC_021.fbx.
i.e. it is
var body = object.children[2].children[1];
var box = new THREE.Box3().setFromObject(body);
var size = box.getSize(new THREE.Vector3()).length();
console.log(size); // 6.79
object.scale.multiplyScalar(size); // It seems good about scale.