Hello Babylon.js community!
Currently, I am playing around with the PositionGizmo
with “snapping” enabled.
I was wondering
- how I would know in which direction the gizmo was dragged (positive vs. negative) and
- therefore, would like to ask if it is expected that the
snapDistance
passed by theonSnapObservable
seems to be the absolute value (unsigned). - is it true, that the position of the mesh attached to the gizmo is not yet updated in the callback of
onSnapObservable
?
I think I would have expected that it would return a negative value if the gizmo gets dragged into the “opposite” direction so that I could calculate the new position already in the callback .
Please, see this playground and specifically the following part.
gizmo.snapDistance = 0.1;
gizmo.xGizmo.onSnapObservable.add(snap => {
console.log(
snap.snapDistance, // Only absolute value of dragDistance
gizmo.attachedMesh?.position // After first drag, position is still 0,1,0
)
});
Thanks in advance for your clarification !