How do I convert latitude and longitude to meters in C2????

Get help using Construct 2

Post » Thu Oct 02, 2014 1:26 am

Hi guys, i have a big problem and i not found nothing here in the forum or in the Google to help me.


So, lets go.

Look the problem:

I have the initial distance (Example):

Latitude: -22.5457785
Longitude: -44.5447771


The final distance:

Latitude: -22.548887
Longitude: -44.55080


I did this script:


Image

But im not getting the 100% correct distance. The diference is between 8-11%.


How can i fix this? Somebody knows a better way to calculate distance using latitude and longitude? Its very important to my project.


Or if somebody know a good plugin that i can work inside them. The Google maps is cool, but dont allow this.



PS: The GPS latitude and longitude are receiving info from Geolocation of construct.



Thanks all and sorry the bad english.
B
5
S
1
Posts: 5
Reputation: 585

Post » Thu Oct 02, 2014 1:47 am

I suspect you're falling for the classic floating point numbers trick.

https://www.scirra.com/blog/141/common- ... nd-gotchas

Scroll about halfway down to "Expecting math calculations to be exact"
B
86
S
43
G
71
Posts: 601
Reputation: 43,619


Return to How do I....?

Who is online

Users browsing this forum: David181, evillair and 59 guests