onDragObservable with BoundingBoxGizmo?

Hi all. Am trying to get my BoundingBoxGizmo to tell me where it is. But onDragObservable not working (as I’d expect it to). Following instructions here: Use Gizmos (eg. Drag arrow, Bounding box) - Babylon.js Documentation

https://www.babylonjs-playground.com/#487FSE#3

Gizmo doesn’t seem to have a dragBehavior, but it does have a pointerDragBehavior… however, an observable attached to that doesn’t do anything.

Any ideas?

Well, figured out another way to do it:

    var dragobserver = new BABYLON.PointerDragBehavior();
    dragobserver.onDragObservable.add((event)=>{
      console.log("drag",meshid);
      console.log(event);
    })
    mesh.addBehavior(dragobserver);

It will be available in 10 minutes in preview.

Is there a solution for this? I am seeing the same behavior.

this.gizmoManager.boundingBoxDragBehavior.onDragStartObservable // Exists
this.gizmoManager.boundingBoxDragBehavior.onDragEndObservable // Exists
this.gizmoManager.boundingBoxDragBehavior.onDragObservable // Doesnt exist (can we add)
this.gizmoManager.gizmos.boundingBoxGizmo.pointerDragBehavior.onDragObservable // Exists but doesn’t work

You can do it this way: https://www.babylonjs-playground.com/#487FSE#5

it does not work in the pg cause another drag is added to the box :slight_smile:

Hi Sebavan, thanks for the prompt response.

For my usecase I am using gizmoManager which uses the behavior:
public boundingBoxDragBehavior = new SixDofDragBehavior();

  • PointerDragBehavior has the observables

    • onDragStartObservable
    • onDragEndObservable
    • onDragObservable
  • SixDofDragBehavior has the observables

    • onDragStartObservable
    • onDragEndObservable

… Can we add onDragObservable?

PR is in Add drag behavior on drag by sebavan · Pull Request #9239 · BabylonJS/Babylon.js · GitHub should be in the next nightly

Thanks Sebavan, you’re the best!!