Change block height

Good afternoon.
There are 2 blocks

I need to make the height of 2 block equal to the height of 1 block
How can I do that? :roll_eyes:

Hi!

If scaling on y-axis is okay, then
mesh2.scale.y = mesh1.height / mesh2.height;

mesh1.height
height ? mesh1.geometry.boundingBox ??

Yes, but it’s up to you, how you get objects’ heights.

There was a problem when using boundingBox


How else to find out the sizes - mesh?

Y can get 2 coords of vertices by index

const v1= new THREE.Vector3().fromBufferAttribute(mesh.geometry.attributes.position, 0);
v1.applyMatrix4(mesh.matrixWorld);

and then use v1.distanceTo (v2)

1 Like