How to make draggable objects collide with other parts

I am working on making a dragging thingy in my game, and I need help preventing the object being dragged from colliding with other parts. The part has collisions, but since it is going off of the mouse position it doesn’t care about them lol. I figured raycasting would do the trick, but I am the absolute worst at raycasting.

Visual demonstration:

Never tested it but i think alignPosition could solve it. Keep setting the position of the alignPosition to the mousePosition. It would probably prevent the part from going through the wall.

in the script where you drag it, set the mouse’s target filter to a folder or model that you want to ignore.
Edit: yes, this may not be what you asked for, but I noticed that it seemed to be getting stuck on an invisible wall. Also, if it’s going off of the mouse position, it shouldn’t be completely inside of/under the floor, would help if we could see the code.

This is the right answer, instead of moving the part using Position, use Mover Constraints to move the part to the mouse’s position. This way it will still collide with other parts.