PointerDragBehavior with collision

How can I adjust that the mesh collides with a wall when it is moved and cannot be moved outside the wall? (Example: Room with couch to move).

Thank you :slight_smile:

Pinging @trevordev

Does this example work for you? Babylon.js Playground

It checks the position when moving and if it collides it sets the position to the previous

Cool feature! I didn’t know this existed.

I was playing with trevordev’s example and added wall sliding. The movement of the sphere is done in two stages, and if it can continue to move in x or z it does. This does not handle rotation, so use is limited.


1 Like