mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

How to use GeoToWorldPosition method

Open willychang21 opened this issue 8 years ago • 7 comments

How to place AR object at specific longitude and latitude in real world , Im using worldscaleAR I know GeoToWorldPosition method ,and I read https://www.mapbox.com/mapbox-unity-sdk/api/unity/Mapbox.Unity.Utilities.Conversions.html , but I still don't konw how to use it.

AND do I let the object walk on the map randomly,I have read https://blog.mapbox.com/placing-ar-portals-all-over-the-world-pt-2-1470b0f70281 , but he used sdk 1.3 .I used sdk 1.4 and followed his tutorial and use the same script.But it didn't work at the end. I konw it's a basic problem, I 'm a unity beginner hope anyone can help me plz.

willychang21 avatar Apr 13 '18 10:04 willychang21

Hi @willychang21, the conversion methods can be found from the AbstractMap class. You can reference that to get access to GeoToWorldPosition method.

doerrdude avatar Apr 13 '18 15:04 doerrdude

@lauri-rustanius @jordy-isaac I use spawn on map at specific position ,it work successfully ,but the original spawn appear on the player here is the result I record. https://www.youtube.com/watch?v=-OpU7jRZBRc what did I miss??

another Q : how do i let an object appear in an area randomly and how do I let them appear when the user close to the target at a distance of 100 meters??

willychang21 avatar Apr 16 '18 07:04 willychang21

Hard to tell. Can you show a snippet of the code you're using? You want to probably place the objects after the map has called the OnInitialized event.

doerrdude avatar Apr 16 '18 12:04 doerrdude

Also, it's good to snap the spawnable objects transform.position.y on the BoundedPlane.center.y position, so they won't be hovering on air. You can find the event calls for BoundedPlanes in ARInterface.planeAdded and ARInterface.planeUpdated.

doerrdude avatar Apr 16 '18 12:04 doerrdude

@lauri-rustanius @jordy-isaac I had modify successfully ,but the map will visualized in the ar camera as a plane, and when I moved the map ,it would be moved out then I could see the ar camera from the map here's the link I demo: https://www.youtube.com/watch?v=HgSd7Yu4HwQ&feature=youtu.be

willychang21 avatar Apr 17 '18 12:04 willychang21

@willychang21 Please let us know if you are still having trouble with this after upgrading to v1.4.1. Thank you!

jordy-isaac avatar Apr 19 '18 21:04 jordy-isaac

hello, i don't know how exactly to use GeoToWorldPosition method to place AR objects at specific longitude and latitude

mennaElnemr9 avatar Jun 28 '21 06:06 mennaElnemr9