Can non-uniform scaling be disabled on the bounding box gizmo

If I want to only be able to scale a plane mesh uniformly (keep aspect ratio), is there a way to disable the handles on the sides of the plane that let it be scaled in one axis only?

cc @cedric

You can disable scaling axis with axisFactor

gizmo.axisFactor = new BABYLON.Vector3(1,0,0);

will disable axis that is not touched by X

Thanks. I wondered what axisFactor was but couldn’t find it documented anywhere.

Sorry, I realize my original question was misleading. If I disable x and y, then I can’t scale at all. But if I enable only x, then I can scale non-unifomrly in x which isn’t what I want. I’d like to have corner affordances only, but still be able to scale uniformly in xy.

You can also tweak the scaling values with an observable like this:

gizmo.onScaleBoxDragObservable.add(() => {
  mesh.scaling.y = mesh.scaling.x;
  mesh.scaling.z = mesh.scaling.x;
});

That would just set the y scale and z scale to be the same as the x. I want the same aspect ratio, e.g. 8 x 6. I just want to hide or disable the scaling handles along the top and sides of the plane and only have scaling handles on the corner since those handles preserve aspect ratio.

We are feature locked until 5.0 release but I’ve found a workaround by disable boxes you don’t need:

1 Like

Hello @ericwood73 just checking in if your question has been answered

Yes. Sorry I forgot to mark the solution.

1 Like