Sliding boxes

The rules applied to “slide” the box can vary too much for a general one-fits-all solution. If you manually use “SetWorldLocation”.

Maybe you can use overlap callbacks. As long it overlaps, try to find a better spot. As said, which spot is “better” depends on too many parameters, like how is your world build up, which control behaviour do you wish, has is to be very sticky to the cursor or is it able move freely?

I would try to think about what does define the “next best spot” in your world if it overlaps.

Otherwise you have to use pure physics. Which might be come the closest to find “next best spot” in case of collisions. That will not result in very smart solutions in mose cases but makes your world feel solid and works in easy situations like sliding at a wall.

Just use the vector between the center of your box and the destination and apply that as a force to your physical objects. If you pull the box against a wall, it will slide automatically at a spot where the force is minimal.