Few Gizmo Bugs and Improvements/Requests

I am currently developing a scene editor (much like the Babylonjs Editor) and the heart of my project are basically Gizmos, to translate, scale and rotate meshes.
I like the Babylonjs gizmos, but there are a few quirks with them when it comes to doing stuff like snapping, scaling, dragging the gizmo, etc. which is why I would love to get these bugs fixed and feature requests added.

First of all some bugs:

PG: https://playground.babylonjs.com/#851PUZ#13

Using snapping with the ScaleGizmo (and also BoundingBoxGizmo) and scaling down a mesh causes mesh to disappear, not being able to scale it back up.
(this behaviour is even worse with the boundingBoxGizmo, sometimes the pos and scale values even become NaN)

I’ve tried fixing this by adding checks to the dragObservable like so, but this didn’t really fix the underlying issue:

if (mesh.scaling.x < 1 || isNaN(mesh.scaling.x)) {
    mesh.scaling.x = 1;


Bug 2:

Not being able to smoothly drag a gizmo when very far away from it (dragging gizmo suddenly stops)

PG: https://playground.babylonjs.com/#851PUZ#12
(try rapidly dragging the gizmo back and forth, you will see that it stops at times)

I’m working with larger scenes, which is why this bug is quite annoying.

Now onto the feature requests:

Dragging the ScaleGizmo or the BoundingBoxGizmo to scale a mesh a significant size is very hard to do sometimes, especially when the mesh is “thin”. (You can see what I mean in the first video, ~11s in).

I would love to have an option to drag the gizmo to exactly wherever the mouse pointer is at, like seen in this video:

I’ve tried messing around with the sensitivity and scaleDragSpeed settings, but none really achieved what I was looking for.


And finally, Incremental snapping as described here.

Would be making my life much easier.

Everything other than these few bugs and quirks, the Babylonjs gizmos are amazing.

Tagging @Cedric

Same as ScaleGizmo incremental snapping - #6 by Cedric
I’ll try to work on it this week.


Thanks! Looking forward to seeing the bugs fixed and feature requests added :slight_smile:

1 Like

WIP, check the status to know when it’s merged


Awesome, thanks a lot!
Not sure if you are already working on it, but also having the incrementalSnap option for the BoundingBoxGizmo would be nice :+1:

I would suggest that you test the feature, I may make some adjustments and if everything is alright, then let you open a new thread for boundingboxgizmo with a test playground.
It may sound a bit bureaucratic but It’s the best IMHO to not lose track of anything. and I can schedule things better because of emergencies and change of priorities

1 Like

Sounds good, will do :+1:

1 Like