Battle.net has an inherent lag to it, you can't do anything about it. When you move the mouse or camera, there is going to be a delay before the values in the triggers update.
What optimizing the library does is allow you run many more projections before a noticeable slow down (that's not due to battle.net lag) is apparent.
Out of interest, if you already have the Mouse World Coordinate (from mouse tracking), what is the minimum code required to project this world coordinate to the UI?
I have a dummy unit moving with the mouse, but can't think of a simple way to translate that to the UI.
The mouse already does this; you can get both it's world and UI coordinates. I only use the baneling example to show how accurate the functions are. This library is useful if you don't/can't use the mouse for that purpose.
For instance, in the example map I have an arrow that points at the siege tank no matter where it is. Since I'm not following the siege tank with the mouse, there is no easy way to know it's position on the screen and that's where the library comes in.
Additionally you can know where the mouse is pointing on the world even if you don't move it, such as if the camera moves but the mouse doesn't.
You'd want to use this library any time you want UI elements that interact with elements in the world, such as by having custom unit bars or have a command card appear on top of a unit.
This library contains a function that will project any UI point down onto the world. It requires knowing the player's camera target, distance, yaw, pitch, roll, fov and their resolution. Additionally it assumes the terrain is flat. Arbitrary terrain could be done with tracelines.
It's original purpose as a mouse tracker has been made obsolete but one person has requested it. The inverse function, mapping world to UI coordinates has more uses and I'll see if I can get that up soon [EDIT: Done].
Notes
Added World to UI Projection. See picture below
Added an intialization function that must be run every time camera position or orientation changes
The example map uses the mouse coordinates to pick the UI point to project onto the world to place the baneling under the cursor. It is not using the Mouse World Pos. Also the baneling's position is updated regardless if the mouse is moved, so moving the camera with arrow keys will also move the baneling to the correct position. Camera orientation can be altered with holding right click, distance with W/S, field of view with Q/E, height offset with mouse side buttons and roll with A/D.
After placing the unit, a dialog is moved to the location of the baneling. This function is not using the MouseUI X/Y but the World -> UI projection from the calculated position of the unit. The same is done for a tank unit on the map.
@KratsAU: Go
Battle.net has an inherent lag to it, you can't do anything about it. When you move the mouse or camera, there is going to be a delay before the values in the triggers update.
What optimizing the library does is allow you run many more projections before a noticeable slow down (that's not due to battle.net lag) is apparent.
Updated Library, should run much faster now.
The mouse already does this; you can get both it's world and UI coordinates. I only use the baneling example to show how accurate the functions are. This library is useful if you don't/can't use the mouse for that purpose.
For instance, in the example map I have an arrow that points at the siege tank no matter where it is. Since I'm not following the siege tank with the mouse, there is no easy way to know it's position on the screen and that's where the library comes in.
Additionally you can know where the mouse is pointing on the world even if you don't move it, such as if the camera moves but the mouse doesn't.
You'd want to use this library any time you want UI elements that interact with elements in the world, such as by having custom unit bars or have a command card appear on top of a unit.
Updated the library. Now has World to UI Projection. This works on any terrain (with a few restrictions).
This library contains a function that will project any UI point down onto the world. It requires knowing the player's camera target, distance, yaw, pitch, roll, fov and their resolution. Additionally it assumes the terrain is flat. Arbitrary terrain could be done with tracelines.
It's original purpose as a mouse tracker has been made obsolete but one person has requested it. The inverse function, mapping world to UI coordinates has more uses and I'll see if I can get that up soon [EDIT: Done].
Notes
Library
http://static.sc2mapster.com/content/files/505/331/Screen_To_World_Projection.SC2Lib
Example Map
http://static.sc2mapster.com/content/files/505/332/UI_Screen_To_World_Projection.SC2Map
The example map uses the mouse coordinates to pick the UI point to project onto the world to place the baneling under the cursor. It is not using the Mouse World Pos. Also the baneling's position is updated regardless if the mouse is moved, so moving the camera with arrow keys will also move the baneling to the correct position. Camera orientation can be altered with holding right click, distance with W/S, field of view with Q/E, height offset with mouse side buttons and roll with A/D.
After placing the unit, a dialog is moved to the location of the baneling. This function is not using the MouseUI X/Y but the World -> UI projection from the calculated position of the unit. The same is done for a tank unit on the map.