AR app using GPS data
Hello all!
I'm trying to create an AR app which use GPS and some external data. It's similar to existent ones like Nokia City Lens or Wikitude World Browser. So it's without any markers (as I understand).
I tried search any tips here but unsuccessfully.
Nokia City Lens example: https://www.youtube.com/watch?v=55Qdem9pJxY
Wikitude World Browser example: https://www.youtube.com/watch?v=Tep9x-KOPy0
What I need to know how to draw some specific marker(like a small pic+description) on the screen according to it's and mine GPS coordinates.
The target's GPS coordinates are provided by some external source via WiFi (also how to do that?).
All help is welcome (especially the code examples)!
Some answers I was managed to found: A small pic+description could be done with GUIContent.
http://answers.unity3d.com/questions/542274/gui-button-with-both-texture-and-text.html
Answer by anildas · Jan 18, 2016 at 04:52 AM
Since you use GPS data, I'm assuming it's a mobile app. As you can predict user location values through multiple ways (Using actual GPS data and using network data like mobile or WiFi but with different accuracy), You can use the lat-long coordinates to find the azimuth of target location and use that to find where is it, with respect to your user location.
Thanks for the tip! In suggested way I can only have the azimuth to the target. That's something but I wonder how to draw a marker on the view not only the direction. If we have some obstacle (a building for example) at the marked direction - that's not clear if your target just before the building or on the 4th floor or on the other side of the bilding and so on. I assume that a rangefinder could be used (dunno if there a unity3d solutions available) + a height data provided with gps coordinates as well.
You can maybe look at GeoCoordinate Class in the location package which has latitude and longitude coordinates and may also include altitude and its accuracy. But I don't think (at least as of now) you will be able to deter$$anonymous$$e the exact vertical position of your target. If you find a better way, please let me know as well.
Answer by AR_newbie · Jan 21, 2016 at 01:44 PM
Please advise me guys,
Now I'm looking how to draw a marker of the target on my compass bar (done with gui.label).
I have 2 GPS coordinates (first of my target and the second of my own).
Also I've found the following topic :
http://answers.unity3d.com/questions/908877/get-azimuth-from-relative-direction.html
and I have a couple of questions:
1)
var azimuth : float = Mathf.Atan2(direction.x, direction.z)*Mathf.Rad2Deg
why this line has this
*Mathf.Rad2Deg
?
2) As I understand I need to calculate these latitude-longitute coordinates like this (to calculate the bearing):
Bearing from point A to B, can be calculated as,
β = atan2(X,Y),
where, X and Y are two quantities and can be calculated as:
X = cos θb * sin ∆L
Y = cos θa sin θb – sin θa cos θb * cos ∆L ‘L’ be the longitude, ‘θ’ be latitude,
How to choose which point will be "a" and "b" for the formula above?
I've took this formula from http://www.igismap.com/formula-to-find-bearing-or-heading-angle-between-two-points-latitude-longitude/
There is an example there which could clarify what I mean in 2nd question
Hi,
"$$anonymous$$athf.Atan2(direction.x, direction.z)" will give you the inverse tan of x and z in radians. If you need to convert it into degrees, you can multiply it with the constant "$$anonymous$$athf.Rad2Deg".
Since you need to calculate the bearing from your location to the target location, a can be your (user's) location and b can be the target.
Your answer
Follow this Question
Related Questions
Trying to make an AR android app based on GPS location with a videoclip (instrad of a 3d object 0 Answers
how to place 2d/3d objects in real world based on location and altitude... 0 Answers
¿How can I place an object based on GPS location? 0 Answers
Placing lare objects at GPS site using MARS and / or AR + GPS plugin 0 Answers
Problem with AR+GPS - GPS Stage Object goes automatically into ARLocationRoot 1 Answer