Thread Tools Display Modes
02/27/15, 03:30 AM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Exact Waypoint Loc

I'm trying to figure out a way to keep track of different waypoint locations (that will be set on mapPin locations).
First I started by using the tooltip text of the mapPin, so that I would know which pin I had placed a waypoint at. But then ran into problems where some addons that create custom pins have multiple mapPins with the same name. I then thought I would also check the x/y coordinates, but ran into another problem.

When I set a waypoint and then call GetMapPlayerWaypoint() the coordinates are not the same:


My only guess is that it is doing some kind of scaling for the map size or it has something to do with the MAP_TYPE_LOCATION_CENTERED (but I could find no other MAP_TYPE_LOCATION to use). I am ? guessing that the waypoint texture is getting centered on the coordinates that I am setting the waypoint at, but GetMapPlayerWaypoint() is returning coordinates to the TOPLEFT of the waypoint?

Either way that makes the waypoint coordinates no good since I do not know what coordinates the waypoint that I set will end up with.

I could do some math and just guesstimate how close the pin is to the coordinates I set and if its "close" just accept that its probably the same point. But if the difference in coordinates is due to some kind of map size scaling, trying to decide what "close" is becomes harder since every map may have different scaling.

I was just curious if anyone knows a better way or if there is some way to force it to set the waypoint at the location I specify so GetMapPlayerWaypoint() will return the exact same coordinates.

Last edited by circonian : 02/27/15 at 03:38 AM.
  Reply With Quote
02/27/15, 04:10 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
There must be some calculation messing up the original value (coming from the used precision). But if you round it to 6 decimal places, it should be 0.5 again.
Maybe that way?

Last edited by votan : 02/27/15 at 04:18 AM.
  Reply With Quote
02/27/15, 06:26 AM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Ah I didn't think of that when I did an example using 0.5, but the addon is actually setting waypoints using mapPin normalized coordinates which appears to have the same precision as the GetMapPlayerWaypoint() and it still returns the wrong values so I don't think that is it.

Rounding would be a nice easy way to handle it, but my main concern with rounding is that since I don't know "why" the values are different the amount of error might be relative to the map your on (its size or some kind of scaling factor) which would mean rounding to x decimal places might work on one map and might cause problems on another or it might be a different reason completely that could cause other problems...I guess I could run around maps & test that theory though.
  Reply With Quote
02/27/15, 06:46 AM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by circonian View Post
I was just curious if anyone knows a better way or if there is some way to force it to set the waypoint at the location I specify so GetMapPlayerWaypoint() will return the exact same coordinates.
It's just my guess, however I think that's not possible. Tamriel probably has a coordinate system that covers all of it; doesn't matter whether this base system uses integer or floating-point coordinates, it's so huge that at some point precision will degrade. When you set a waypoint, you don't stick a pin in the local map - it's map-local coordinates must be transformed into world-coordinates for it to be visible at other zoom levels, too. And when you query a waypoint, they're transformed back into your current map's local coordinates.
  Reply With Quote
02/27/15, 07:05 AM   #5
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
It's just my guess, however I think that's not possible. Tamriel probably has a coordinate system that covers all of it; doesn't matter whether this base system uses integer or floating-point coordinates, it's so huge that at some point precision will degrade. When you set a waypoint, you don't stick a pin in the local map - it's map-local coordinates must be transformed into world-coordinates for it to be visible at other zoom levels, too. And when you query a waypoint, they're transformed back into your current map's local coordinates.
Ah, I didn't even think about the conversion for different zoom levels. That would make sense.
  Reply With Quote
02/27/15, 08:54 AM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Originally Posted by circonian View Post
Ah, I didn't even think about the conversion for different zoom levels. That would make sense.
That's what libGPS is doing... it converts from coordinates on the individual local maps to normalized coordinates on the Tamriel map.
  Reply With Quote
02/28/15, 04:53 AM   #7
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Thank you everyone for the help. I found a much better way to do it without using the coordinates, so its no longer an issue.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Exact Waypoint Loc


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off