Customizing gizmo

Is it possible to restrict the bounding box motion to only x and z axis? And also turn off the rotation feature?
I also would like to not show the bounding box “blue box” on the mesh. I want to only drag the mesh.
ps: I already know how to use drag behavior but I want to use gizmo for that

Heya, here’s an example that I think does what you’re after. I’m assuming that you want to use the GizmoManager to handle the mesh selection but have it just drag the mesh without any of the BoundingBoxGizmo features? So the playground creates a PointerDragBehavior which supports the wanted dragging restrictions and uses the GizmoManager’s onAttachedToMeshObservable to attach and detach the behavior. :slight_smile:

1 Like

Thanks. I also want to apply this behavior to only specific meshes in the playground. I would like to keep the meshes I want in the gizmo manager. Is this possible?

And I also would like to snap the drag behavior on the grid material only if shift key is pressed

Here is one example using the grid material for the snapping feature. In this case, onpointermove event is used but I want to apply this in the drag behavior of some meshes using gizmo

Yep you can use the GizmoManager’s attachableMeshes array to limit which meshes can be selected and dragged. Here I limited it to just the sphere for example. And also used the validateDrag function to snap the position like the PG you linked, but only when the shift key is pressed. EDIT: and changed it to use dragDeltaRatio 1 so that it snaps right away. :slight_smile: :beers:

2 Likes

That is perfect

Thank you

@Blake, you are on fire :slight_smile: Thanks a lot

1 Like