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):
http://profs.sci.univr.it/~colombar/html_openGL_tutorial/images/perspective_proj_glupers.gif
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:
http://img9.imageshack.us/img9/7492/perspectiveprojection.png

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? ;)

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Oct 01, 2011
Category
Last update
Oct 01, 2011
Development stage
Release
Language
  • enUS
License
MIT License
Downloads
180
Recent file

Authors