Trace one object being fully above another

I have two rectangle-shaped objects: magnet and metal box. I want magnet to grab the box on keyboard input, but only if it is fully above it (each corner is above the box). If I use LineTrace, I can check only if magnet’s center is above the box, but not every corner. If I use BoxTrace (trace box size is equal to magnet), I get true even if just a pixel of the magnet is above the box. The same thing with OnHit and OnBeginOverlap events. The only I solution see, is using 4 LineTrace for each corner, but it seems quite clumsy. Is there another way to solve the problem (maybe something like BoxTrace which returns true only if it’s every corner hits object)?

Not really sure what system you are trying to set up, but there are a few ways.

One would be to translate the object into the magnets local space and check if the 4 corners are within a defined square.

You could do a BoxOverlap test on 4 Points and if all 4 points are overlapping, do the magnet thing.

If you have a physics system, then just apply a force on the closest point towards the magnet based on distance.