Work with size instead of Scale gltf obj

I will try to be more explicit as i did not find an answer lately
How the size(not scale) of (gltf.scene) can be expressed in dat.GUI? I get the actual measurements set from blender in meters. In three, i can manipulate the scale but that would mean that scale.x = 2 is 1.8 meters if the original 1 scale is equal to 0.9 meters for ex.
I am looking for a way to manipulate the size direclty .
Thank you

The size can just be taken to be the scale multiplied by the size, for scale=1.

You could use a bounding box when you don’t know or want to hardcode the initial size:

var boundingbox = new THREE.Box3().setFromObject(obj);

Furthermore you will need a custom Dat.gui property, something like:

var conf = { x: S.x * obj.scale.x, y: S.y *obj.scale.z, z: S.z *obj.scale.z) };
folder.add(conf, ‘x’).onChange(function (sv) {obj.scale.x = sv/S.x; });

Where S is your size for scale=1.

1 Like

Will leave the solution here, thanks for replying

First i assigned a custom property to each gltf obj that is added to keep track of each obj bounding box sizes.

dat.GUI takes the size * scale 1 (that is defined from blender as scale 1)

Lastly on change, the actual size is set