BoundingBoxGizmo drag behavior

Hey community, I was wondering if there is elegant way of enabling only x+z axis drag mode by default while using boundingbox gizmo?
Thanks in advance

Adding @Cedric

Hi @Marin_Pericic

Nop but I can add a mask so you can enable it per axis.

@Marin_Pericic
I forgot I already did it some time ago :smiley:
Here you are:

As much as i can figure this feature isn’t available in 4.2.0, right? Documentation is a bit vague if there is no lib version highlighted.

Nop, it’s available in 5.0 alpha 13+

1 Like

i’ve just looked into this, this is ment to restrict resizing on axes, i was trying to figure out how to restrict drag moving on single or 2 axes?

Sorry, I’m not following you. Can you explain it a bit more? Do you want to constraint the mouse pointer movement?

i’d like to override default pointerdragbehavior that is active when bounding box is enabled and boungindboxgizmo.enableDragBehavior = true, by default it enables dragging in all axes, i’d like it to be enabled in 2 axes only. But I don’t want pointerDragBehavior to be active without boundingboxgizmo being active.

https://playground.babylonjs.com/#BYSISE
not sure if i explained my intentions good enough, i’d like to enable dragging cube on x and z axes only with bounding box gizmo, is it possible?

Ho! I get it now! I can add a new mask property to enable/disable drag delta.

It’s not that easy to change SixDofDragBehavior.
Can you try to add a pointerDragBehavior when the mesh is picked by the manager ?

var pointerDragBehavior = new BABYLON.PointerDragBehavior({dragPlaneNormal: new BABYLON.Vector3(0,1,0)});

pointerDragBehavior.attach(box);

the dragplane is what you need.

I’ve found a suitable solution, had to dig around a bit but i think
gizmoManager.boundingBoxDragBehavior.options = {dragPlaneNormal: new BABYLON.Vector3(0,1,0)}
is good enough, i wasn’t aware of this option.

1 Like

I was not either! Thanks for pointing it

2 Likes