Right now building positions are only a positional array of [x,y,z]. By adding a rotation value by default, indicating the most reasonable direction to face (e.g. out of the window, towards a door if inside and against a wall), it would significantly improve garrisoning towns/buildings via script and make bloated calculations unnecessary.
- Legacy ID
If the BIS default site modules are unpacked, you can see that they added the rotary values to all building positions by hand, and placed the units accordingly.
Then the unit is set using
BIS_currentDude setDir direction _building + (_x select 3);