AxisDragGizmo not raising validateDrag on dragBehavior

Hello, I’m trying to “cancel” a drag on AxisDragGizmo, and I would like to use the validateDrag handler to it, as it is working very well on PointerDragBehavior. But on AxisDragGizmo it seems not to be fired. Is it a bug of the library or am I doing something wrong?

A repro in the playground would be amazingly helpful as it is hard to tell from the description only.

Here we are

sample | Babylon.js Playground (

As you see the validateDrag is not raised at all

Thanks a lot @Cedric will be able to have a look into it next week :slight_smile:

I think I can plug validateDrag in AxisDragGizmo, let me check …

1 Like

validateDrag support added to AxisDragGizmo by CedricGuillemet · Pull Request #11172 · BabylonJS/Babylon.js · GitHub


Thank you very much!

I’ve updated to the new version, and I see now the validateDrag is being called. But I you can see on this example

seba | Babylon.js Playground (

the way I set up the X and Y drag gizmos is not working as expected, the collision is still happening in some way, it’s no precise as I expeted to. Could you help me understand what I’m doing wrong?

Thank you


I’ll be taking a look on monday :slight_smile:

1 Like

Hi @Toni_Bruno

It seems to work, sphere is colliding fine.
What shall I check?

Try to collide it from the X axis

X or Y axis works the same. Calling moveWithCollisions will slide the sphere. If both spheres are perfectly aligned, a sliding vector is not found and sphere doesn’t move. If you want to prevent sphere from moving (ie, no sliding), then check sphere collision and return false if colliding.
By checking the distance between both sphere, you can verify is the validation is true.

seba | Babylon.js Playground (

I understood more or less what you’re saying, can you be so kind to change my example to let me understand better how to avoid `moveWithCollisions’ in order to decide if I have to return true or false on validateDrag? It would be very helpful, thank you again for your kindness

Sure, did you check this PG:

What is missing for you in this example?

1 Like

Sorry, I didn’t understand you changed it! thank you!!!