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.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
6 People are following this question.
Input.location.start always times out
Location Service in editor, will it return fail?
How do you repeatedly check iPhoneInput.lastLocation?
Is it normal for string operations to be very expensive on the iPhone?
irl Location Tracking for points