LineTrace puts a held object through the ground

on the release you would take the impact point and offset it so the box doesn’t teleport into the wall.

Off the top of my head I think the formula would be.
impact point + (impact normal * distance from wall/floor)

the “distance from wall/floor” is just a float variable that would give a bit of space from the floor on the release.

It won’t work in corners and certain cluttered spaces. you could run a check by doing something like making a box collision and sending that through to the expected release point get all overlaping actors if that array has a length greater than 0 change the crosshair color to red and not allow the player to release the the box until he turns to face a valid surface.