ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Wish List (https://www.esoui.com/forums/forumdisplay.php?f=177)
-   -   [open] WorldPositionToMapPosition (https://www.esoui.com/forums/showthread.php?t=9251)

Shinni 07/03/20 10:25 AM

[open] WorldPositionToMapPosition
 
I would like to request the following API function:
WorldPositionToMapPosition(zoneId, worldX, worldY, worldZ)
- normalizedX, normalizedY

It takes 3d world coordinates and converts them to 2d map coordinates with respect to the current map.
For example WorldPositionToMapPosition(GetUnitWorldPosition(unitTag)) should behave just like GetMapPlayerPosition(unitTag).

So far, addons can only convert from 3d world to 2d map coordinates via
a) Use SetPlayerWaypointByWorldLocation(worldX, worldY, worldZ), then read the map location of the waypoint.
This is very slow and has a bunch of side effects because of all the callbacks/events it triggers. Also this approach only works for the currently visited zone.
b) Use SetPlayerWaypointByWorldLocation to "measure" the zone, i.e. figure out a linear transformation (scaling + translation) that converts between 3d world and 2d map coordinates. Then use the linear transformation for all to be converted points. This approach is used in the libraries libGPS and lib3D.
The problem with this is that it doesn't work in zones like Blackreach and Imperial City, because there the conversion is not linear. Also both libraries must measure a zone before conversion is possible, so the player must have visited it before.


PS:
For completeness sake it would also be nice to have the reverse function (i.e. MapPositionToWorldPosition), but from my understanding that might not be implementable.
Personally, just being able to reliably convert from 3d to 2d would already cover all my use cases.

Shinni 07/14/20 12:10 PM

I realized I did not follow the guideline and add [open] to the subject.
It doesn't seem to be possible for me to edit the title. Is a moderator able to edit it?


All times are GMT -6. The time now is 11:57 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI