Using the physics package to find the closest valid arrangement of colliders?

My game is basically a few capsules inside a box, being moved around by changing their velocities then updating the physics simulation. Occasionally however I need to rotate and or move a capsule instantly. Placing this capsule so it does not intersect with the box is easy, but any number of capsules may intersect when the capsule is rotated. I need to calculate positions and orientations for all capsules so none intersect, and the total change from their original positions and orientations is minimized. Is there anything in the physics package to help with something like this?

Is it good enough to approximate capsules with their AABBs? If yes, that would speed up (and simplify) overlap tests greatly.

I think that your problem is one of those NP problems.
This is going to be hard.

I should have said a close arrangement :), I’m thinking something like: detect a capsule capsule intersection, move both capsules half the distance required to not intersect, repeat until no intersections are found. Before checking capsule capsule collisions check for capsule box collisions and move the capsule the full distance required as the box is static. I would be nice to also consider rotation to rearrange the colliders though