In my project, the user creates their own branching path. For example, it will always start at "A1", but then the user may choose to create a "B1" AND a "B2" (both branching from A1) [Up to three branches may be created per item]. Following this, the user may create a "C1, C2 and C3" from EACH of the B level objects. Obviously, as the user adds more, the more complicated the later paths will be (depending on how many steps, you can create a *huge* number of possible paths).
The problem I'm running into is that the paths overlap when created. For example, you can see the diagram below:
Step one (no problems):
-------------[ B1 ]
[ A1 ]------[ B2 ]
-------------[ B3 ]
Step two (the C items overlap near the center, because the B level items aren't spaced well):
----------------------------[ C1 ]
--------------[ B1 ]-------[ C2/C4 ]
[ A1 ]--------[ B2 ]-------[ C3/C5/C7 ]
--------------[ B3 ]-------[ C6/C8 ]
----------------------------[ C9 ]
What I would like to happen is for the branches to take into consideration *where* the other branches are, and move accordingly (so that none overlap). Maybe using a physics object and collisions would make it simpler? I'm not really sure. But I DO want the "parent" of the branch to remain centered behind it's branches. Otherwise it might start looking messy if the branches are bumped all over the place.
Ideally, it would turn out something like this:
----------------------------[ C1 ]
-------------[ B1 ]--------[ C2 ]
----------------------------[ C3 ]
-----------------------------------
----------------------------[ C4 ]
[ A1 ]------[ B2 ]---------[ C5 ]
----------------------------[ C6 ]
-----------------------------------
----------------------------[ C7 ]
-------------[ B3 ]--------[ C8 ]
----------------------------[ C9 ]
One more complication: Each of these items will remain on the same Y location (it doesn't change), but the X location is dependent on its embedded data (though it will always appear AFTER its parent). This means that other B level items could theoretically overlap with the C level items if not planned for accordingly. The final graph should look something like:
------------------------------------------------------------------------[ C1 ]---
--------------------------------------------[ B1 ]--------------[ C2 ]----------
----------------------------------------------------------[ C3 ]-----------------
---------------------------------------------------------------------------------
---------------------------------------------------------------[ C4 ]------------
[ A1 ]-----------------------------[ B2 ]----------------[ C5 ]-----------------
-----------------------------------------------[ C6 ]----------------------------
---------------------------------------------------------------------------------
-----------------------------------------------------------------------[ C7 ]----
--------------------------[ B3 ]------------------------[ C8 ]------------------
-------------------------------------------------------[ C9 ]--------------------
I could theoretically just space each branch according to the number of levels (for example, if it goes to level C, then space the level B further apart, OR if it goes to level D, then space them even further). BUT, by doing this, it will result in a ridiculous amount of empty space, and the A to B level will look just plain silly (the b's could be miles away from the A1, if there are 20 levels!...). Also, it's important to remember that the user may not create EVERY branch on every level (they probably won't, actually).
Thanks in advance for your help! I really appreciate any input (even if it's just pointing me to an example that shows something similar)!





Reply With Quote