How to change mesh size whithout scaling?

I can create the box,width 2.5,height 2.5,but i set this number in mesh is unuseful,i don’t want to use scaling because is Inaccurate.
I use rabbit.babylon from https://www.babylonjs-playground.com/#QY1WYT#0,i want to change rabbit size the same as my box

Hello,

I couldn’t understand what kind of problem was in the use of scaling. Does this help you?

https://www.babylonjs-playground.com/#QY1WYT#72

var boxSize = 2.5;
var box1 = BABYLON.Mesh.CreateBox(“box1”, boxSize, scene);
I create the box with boxSize,but i can’t create the rabbit with boxSize,
rabbit3.scaling = new BABYLON.Vector3(2.5, 2.5, 2.5); this code make the rabbit bigger than before,
but i want to make the rabbit as big as box

Scaling is not inaccurate, but applied according to the mesh’s size.
if a mesh is 0.1 in size,
And you apply scaling by 2
The result mesh “render size” will be 0.2

To find the correct scaling value, you can in most cases use the boundingbox
E.g. Box Size / Rabbit boundingbox size = scaling value to fit rabbit into box.

Update;
Made a PG showing how;
https://www.babylonjs-playground.com/#7BICDZ

I’ve added two prototypes to BABYLON.Mesh class within the PG,
getAbsoluteSize // Calculates the size of a mesh’s boundingbox. (unsure if this is already available, @Deltakosh ?) // 2’nd update. Sorry, same as boundingbox.extendSize * 2 of course…
&
getScalingVectorToFit // Calculates the “scaleFactor” or “scaling value” i wrote about above.
Param; otherVector, e.g the (vector3) size of the box you want the rabbit to fit in.

3 Likes