Prevent drag behavior lag?

https://playground.babylonjs.com/#RHA9MB#2

Even though dragDeltaRatio is set to 1, there is still a bit of lag between where the sphere is and the mouse. Can that be completely removed?

cc @amoebachant

Here is another playground that better depicts the problem I’m having. If I grab the bottom sphere, everything moves in a column (desired effect), but if I grab the middle or top sphere, there is lag and the spheres can be easily dislodged from the column even with dragDeltaRatio = 1.

https://playground.babylonjs.com/#RHA9MB#4

Hi @Kochab, thanks for the question and the playground link! You don’t actually need to create a PointerDragBehavior for each child, because the PointerDragBehavior will be triggered by dragging on the mesh you add the behavior too and any of its children. The reason you were seeing the trailing delay is that when you dragged a child mesh, its PointerDragBehavior was animating and so were its parents.

Try this playground out, I think it will do what you were looking for: https://playground.babylonjs.com/#RHA9MB#5

Thanks!

2 Likes

Yes, indeed! Thank you!

2 Likes