# Match Scale of Parent

**URL:** <https://forum.babylonjs.com/t/match-scale-of-parent/50975>\
**Category:** Questions\
**Created:** [May 31, 2024, 5:02pm UTC](https://forum.babylonjs.com/t/match-scale-of-parent/50975 "2024-05-31T17:02:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgonzosan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jgonzosan/32/10007_2.png) [@jgonzosan](https://forum.babylonjs.com/u/jgonzosan)\
**Post date:** [May 31, 2024, 5:02pm UTC](https://forum.babylonjs.com/t/match-scale-of-parent/50975/1 "2024-05-31T17:02:35Z")

</div>

I’m trying to figure out how I can keep consistent scale with mesh objects. In my project I have a variety of meshes that have differing scales that all read “1” for the x,y,z scale values but are vastly differently in scale between each other.

For this reason I’m trying to utilize a single parent mesh and have those meshes scaled to fit within the bounds of that box. I wanted to provide context in case there is a better way to achieve this.

Here is a basic playground where I added the sphere as a child of the box:

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#97MCAB%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

How could I resize the sphere to fit the bounds of the box? Is there a simple way to achieve this? The only thought I have at the moment is to include some sort of loop that continually increases the scale of the sphere up until it makes contact with the bounds of the parent box. What are my options here?

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [May 31, 2024, 7:02pm UTC](https://forum.babylonjs.com/t/match-scale-of-parent/50975/2 "2024-05-31T19:02:05Z")

</div>

Probably you may use `mesh.normalizeToUnitCube()` function - [Babylon.js docs](https://doc.babylonjs.com/typedoc/classes/BABYLON.Mesh#normalizeToUnitCube)

```auto
normalizeToUnitCube(includeDescendants?: boolean, ignoreRotation?: boolean, predicate?: Nullable<((node: AbstractMesh) => boolean)>): AbstractMesh

```

The `includeDescendants` parameter let’s to use the hierarchy’s bounding box instead of the mesh’s bounding box. Default is false.

---

<div class="post-metadata">

**Author:** ![jgonzosan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jgonzosan/32/10007_2.png) [@jgonzosan](https://forum.babylonjs.com/u/jgonzosan)\
**Post date:** [May 31, 2024, 7:21pm UTC](https://forum.babylonjs.com/t/match-scale-of-parent/50975/3 "2024-05-31T19:21:34Z")

</div>

Looks like just what I need, thanks! I included some simple snippets here to see how it works for anyone who wants a demo:

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#97MCAB%235)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes
