Drag collision effect


I pass let pointerDragBehavior = new BABYLON. PointerDragBehavior ({dragPlaneNormal: new BABYLON, Vector3 (0, 0)});Make these small box drag effect, but I also hope that box will be a collision in the process of drag effect, is the box won’t overlap, now in the process of the drag and drop box overlap, I used the mesh. The checkCollisions = true, but useless, which master can help me solve

Pinging @Cedric

Hi @lp920133349

So, if I understand correctly, you want a physic response between boxes when you drag one with the mouse.
The solution to use depends on what you expect. If the other boxes can be pushed when a collision happens and move accordingly, you need to add a physic impostor per box.
If you simply want to constrain the dragged box by the other boxes, then you can add a check to the PointerDragBehavior and allow or not allow the new box position.

Let me know what you want to do and I’ll do a quick playground :slight_smile: .

Hello, can you do it for me? :grinning:

I’m very busy at the moment but if you have issues, I’ll be happy to check your PG.

1 Like
pointerDragBehavior.moveAttached = false
pointerDragBehavior.onDragObservable.add((eventData) => {
    base.moveWithCollisions(eventData.delta)
})

Does it meet your needs?