Gizmo Custom Stretching

Hi Guys, I’m new to babylon and trying to get my head wrapped around everything. If you take a look at the attached image. It’s an open cabinet with no doors. I would like to be able to stretch this object with the gizmo. However, from what I can see, the gizmo control stretches the entire object with no constraints. For example, if I want to stretch in the width, it will only lengthen the top and bottom of the cabinet. Stretching in depth would increase the depth of each part. How can I achieve the results that I’m looking for? Do I need to create something custom?

Maybe you’re looking for the bounding box gizmo? Each face of the bounding box has a box-shaped gizmo in the middle of it that you can use to stretch the mesh in just one direction. :slight_smile:

1 Like

Hello @gladiator-media just checking in, did you get a chance to check the bounding box gizmo?

Hi there, Thanks for checking in. I was aware of the bounding gizmo. However, my question really resides on how to handle multiple objects inside the gizmo. If there’s a cube or sphere singleton and we are using the gizmo, I don’t have an issue. For my purposes I am creating cabinets. So, I will have a left side, right side, back, top and bottom, all assembled within a container. My question becomes, when I stretch the container, how do i instruct it to extend the length of the top, bottom, and back, and adjust the position for the left and right sides? Hopefully, that makes sense. I feel like I would need to create my own logic for that.

Sorry, I still don’t quite understand the issue :confused: Maybe a diagram would be helpful?

hello @gladiator-media,

If I understand your question, i think you have to build a function which draws the cabinet with its position, length, depth, width and the thickness of the wood that does not change if you use the gizmo.

Then you will use the bounding box gizmo that changes the values of the function, dispose the previous cabinet object and redraw the new one.

For instance, if you stretch the gizmo to the right along the x axis, only the width of the object will be changed, but if you stretch to the left, the width AND the x position will be changed.

For more explanations, you may read the documentation here :

Is this what you were waiting to ?

Boris

Trying to understand exactly,
E.g. If scaling width of the cabinet, he wants to only apply scaling to top / back / bottom “panels” of the cabinet, the side/end panels should not get thicker

This is not an easy task if it is a solid mesh…
If you can seperate it into multiple meshes, e.g. top, back, bottom, left side, right side, doors, etc etc
you can apply scaling more fluently in on the desired groups and move the other meshes to match the new scale.

A gizmo will scale the entire mesh it is attached to.