I'm working on an application that uses VR target recognition to display information on screen. The design is to point out areas of the recognized object and make these objects interactible as well as giving them a label.
As the layout of these objects is dynamic and positioned through code, I'm looking for some guidelines on how I should move things around so that objects don't overlap. I'm not a "UI guy" so I don't have a good basis for deciding what offsets to make or how to prioritize them.
For example, this is what I currently have (with and without the camera input):
Notice that the one "Wheel" label overlaps the box for the front bumper. That's what I want to avoid.
Currently I've made the text offset vertically when it overlaps with other text (prioritizing the labels "closer" to the camera: i.e. "Front Bumper" was moved up because it overlapped with "Wheel" but "Wheel" was closer to the user) but I haven't done anything to prevent the text from overlapping with any of the boxes and the boxes themselves can't move (as they're tied to points in real-world space). Text is placed on left/right depending on whether the center of the text's parent box is to the left or right of the target's cuboid center in screenspace.
What things should I keep in mind from a UI layout perspective as I proceed to write code that will prevent (or at least, minimize) overlaps?
I am capable of drawing a line from the text to the box (as seen in the first image) so I can position the text arbitrarily far away from its parent box. I can't, however, write code to "minimize the total distance of moves" or "use the fewest number of lines" as that requires testing all possible solutions, which is not computable in linear time.
(Side note: the "Light Bar" gets nudged upwards in the first picture by "Front Bumper" due to issues calculating each text's on-screen AABB, but that's not a major concern at the moment).
I'm working in Unity with deployment for the HoloLens, but that shouldn't impact the answer any (although the displayable area of the HoloLens is ridiculously tiny).