- Home /
GPS location string
Hey guys
Is there an importable GPS string location which can be retrieved from iphones or android devices into unity? For example, I want to run different code depending on where the player is in the real world, however I don't want to use precise gps locations. Rather, if the phone knows the player is in "derp park" or whatever , then it would fire a script.
No. You will have to match a precise position to an area. There may be a service doing right that, but you will need a position first.
Damn, I thought that might be the case.
In that case, would I be able to create 4 positions, creating a square, around the players location, creating A broader area? And then react when that square moved covered other set coordinates for locations? (Such as the afformentioned park?
@Captain_Dando- Can you stop posting comments in the Answer section? It messes up conversation ordering, and makes work for me.
Well, you get a latitude and a longitude - the "most correct" way would be to have your character on a sphere :) but for your local problem, you can simply approximate them as x,y coordinates. If you need something global, have a look at map projection techniques.
Thanks for the help guys, you've officially answered all my questions. I don't think I need any more help but i thought I'd share what I'm up to anyways. The map system isn't the main component in my game and I'm debating whether that virtual world would even be shown at all. as it stands, this is the system I am going to use;
the person doing the exploring will be given a tag (something coordinates). that tag controls his object in the virtual map. when that object collides with objects on the virtual map (which correspond with the real world coordinates) a script will be run. Upon leaving the collider, the player will be outside, in unimportant areas, which don't need to be logged.
in order for unity to interpret the gps position I will flatten the gps coordinates to full numbers, and scale the game to fit those numbers with unity's own coordinates. It will take a long time, but after many months of gradually adding colliding objects to the game world I will have a vast library of locations to trigger separate scripts.
Your answer
Follow this Question
Related Questions
Input.location.start always times out 1 Answer
Reverse Geolocation not returning correct country name 0 Answers
Any Augmented Reality SDK plugin with Geo-Location functions? 1 Answer
Ask for Location permission at the start of the App 2 Answers
Is there a way to access GPS data/Input.Location without wifi? On my device (S7) it only works with. 0 Answers