Collision detection

Hi
Lets say Ive got an example like that:
https://www.babylonjs-playground.com/#32M3IH#17
How can I modify it in order to be able to move cubes verticly?
I know that I can uncoment this line
//this.attachOwnPointerDragBehavior(cube);
but then the collision detection stops working.

this is a good question for @Cedric

A ray cast is performed on the ground to get delta vector (line 61).
You can change the orientation of the ground (or make a new one) like that:
https://www.babylonjs-playground.com/#32M3IH#18

Ok, but what is the best approach to make it possible to move those cubes in all three directions with collision detection between them (not to allow them to overlap)?

there is no simple answer to that. Basicaly, you have to convert a 2D mouse delta vector to a 3D one. In this PG, it’s done with the help of a ground plane and raycast.
Maybe you can use Gizmo for that Use Gizmos (eg. Drag arrow, Bounding box) - Babylon.js Documentation

Gizmo looks promising but still I don`t know how to take collisions into account while moving cubes.

I’d create a transform, link a position gizmo to that transform and when the gizmo is dragged, compute the position delta vector. Then use that delta instead of the raycast delta in the PG.

But because Physics is decoupled from the gizmo thanks to the delta, you gizmo can be away from the box. delta vector is an hint for the physics.

Can you make an example on the PG ? Bc I need collision together with gizmo for position/rotation/scaling for my project, too. And I tried many things, but Physics didnt work yet.