Attach Dialog To Unit with auto-hide behind UI
Allows to auto hide dialogs attached to units behind the standard UI.
This trigger requires to know the player's camera distance and angle of view to work correctly.
Note that the map contains a lot of functions to work with vectors, you probably won't need all of them but some are used by the auto-hide function.
This is the 3d model I use (perspective projection):
This model projects a 3d point (game world) into a 2d plane (monitor 2d resolution), if the point is outside the 2d plane then you can't draw it.
Ignore all the other functions in my map, the only one you really need is "Is Dialog Inside Screen For Player"
Others are just useful functions I made for vector modifications, I use them to normalize the system to a 2d model and make the problem easier to solve. You can use them as they are ;)
Here is the drawing I made to calculate if a point is inside the camera:
I just used triangle properties and trigonometry (sin/cosin/tan) to detect the violet line size that tells me if the unit is inside or outside the camera (Y axis).
BTW can I ask you why do you need this script? ;)