The only way I see of fixing this is by subtracting the target position of the camera and the position of the unit and then checking the distance. I made a rough example that seems to work across the resolutions. Check out the attachment.
All aspect ratios except 5:4 share the same height of 1200 units in terms of UI screen resolution. This is not the player's resolution, but the main resolution of each aspect ratio. Look at this chart I created a while back:
As you can see, resolutions with aspect ratio 5:4 have a larger height of 80 units than the other non-5:4 resolutions. This is rather minute. Load up resolution 1280x1024 on the attached map and you will see that the dialog hides a little sooner than the rest of the resolutions, but not by much.
Since the Game UI's models, from left to right, have different heights (minimap is the tallest, command card is mid, console is shortest) and you would want to hide the dialog based on the horizontal position then you would have to know the UI screen resolution of the player. Then you would know precisely how far each model is from the camera target.
in fact I have a 1280x1024 resolution and I saw it hiding too soon. it's a bit annoying if the units custom health bar hides when units are too near the bottom of the screen.
BTW I think I'll have to rework the trigger a lot because my map supports zoom & rotation ;)
Addititonally I'll try to customize the maths to fit perfectly with the different UI heights.
After 1 week of work I was able to make the perfect auto hide trigger for dialogs attached to units.
it works with any angle and distance, it was calibrated with a 5:4 resolution. I need testing with other aspect ratios.
The cool thing is that dialog will hide depending on the height of the encountered UI panel (minimap, command card and console)
Everyone is free to use it but please, if you do so give credits... it was kinda hard to do :P
I know, common behavior for dialogs is to show up on top of the standard UI.
However keeping this behavior on dialogs attached to units is quite weird
Does anyone know if it is possible to make dialogs hide behind the game UI?
@Bibendus: Go
The only way I see of fixing this is by subtracting the target position of the camera and the position of the unit and then checking the distance. I made a rough example that seems to work across the resolutions. Check out the attachment.
Seems legit! However how do you manage different monitor aspect ratio?
All aspect ratios except 5:4 share the same height of 1200 units in terms of UI screen resolution. This is not the player's resolution, but the main resolution of each aspect ratio. Look at this chart I created a while back:
As you can see, resolutions with aspect ratio 5:4 have a larger height of 80 units than the other non-5:4 resolutions. This is rather minute. Load up resolution 1280x1024 on the attached map and you will see that the dialog hides a little sooner than the rest of the resolutions, but not by much.
Since the Game UI's models, from left to right, have different heights (minimap is the tallest, command card is mid, console is shortest) and you would want to hide the dialog based on the horizontal position then you would have to know the UI screen resolution of the player. Then you would know precisely how far each model is from the camera target.
in fact I have a 1280x1024 resolution and I saw it hiding too soon. it's a bit annoying if the units custom health bar hides when units are too near the bottom of the screen.
BTW I think I'll have to rework the trigger a lot because my map supports zoom & rotation ;) Addititonally I'll try to customize the maths to fit perfectly with the different UI heights.
After 1 week of work I was able to make the perfect auto hide trigger for dialogs attached to units. it works with any angle and distance, it was calibrated with a 5:4 resolution. I need testing with other aspect ratios. The cool thing is that dialog will hide depending on the height of the encountered UI panel (minimap, command card and console)
Everyone is free to use it but please, if you do so give credits... it was kinda hard to do :P
http://www.sc2mapster.com/assets/attach-dialog-unit-auto-hide-beh/
If you have any questions you are free to ask
Edit: It seems that the function needs a bit of optimization or it will lag when used on more units. I'll fix it soon