Can I containt a mesh within another mesh?

I have one static mesh following my cursor; I wish to constrain the movement of this mesh to the bounds of a static mesh. The best example I can give of my desired functionality is a volume slider. The slider can be moved back and forth but is constrained by the track it is on. As a note, the slider is just an example and not actually what I am after; I am dealing with 3D objects. It is fairly simple to have the mesh following my cursor stop moving when my cursor is no longer overlapping my static mesh. I position the cursor-following mesh so that it’s center is at my cursor; this causes half of the mesh to stick out of the static mesh when the cursor is at any edge of the static mesh. If anyone has an elegant blueprint solution to prevent the cursor-following mesh from moving when it’s extents are near the extents of the static mesh I would greatly appreciate the insight.