mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
725 stars 210 forks source link

Using Mapbox for an AR viewing experience from a location #1498

Open ksi3321 opened 5 years ago

ksi3321 commented 5 years ago

Hi @atripathi-mb , We are currently working on a native Android/ iOS project in which we have an AR feature that is implemented using Unity. We make use of Vuforia to show the AR Camera. I have hit a critical roadblock and I am unable to find answers so I just thought of asking Mapbox directly.

This is something similar to #710

There is an observation tower from where users can see the skyline of the city and Points of interest are shown over the appropriate buildings. Users can tap on them to read information

I was able to achieve the display of POIs using Mapbox SDK for unity. I made use of the SpawnOnMap script that came with the mapbox samples. I get the latlong values from a backend API and they are converted using the GeoToWorldPosition method. There is a Simulated view and a Realtime view. Simulated view is a preloaded panoramic image of the skyline while realtime view displays the POIs in the AR Camera. The simulated view is something like the CNTower Viewfinder app. We were able to position the image such that it is in sync with the placements of the POI.

The issue we have here is with the Realtime view. While at the location, the area is obviously much bigger than what we see inside the app and the POIs appear in the wrong places. Since the user can be walking on the deck, the placement of the POIs keep changing as we move. I would like to know

ksi3321 commented 5 years ago

@jordy-isaac @atripathi-mb We need your attention please. It is quite urgent.

abhishektrip commented 5 years ago

@maximus9600

how do we setup mapbox for world scale level content i.e what size should the AbstractMap prefab be to mimic the real world? If I need to show hotpspots upto 2km in distance, should the map scale be 2000 units?

The SDK comes with a scaling mode World Scale which scales content at real world scale.

image

how do we make the camera object move while the POIs remain in their positions on the map?

I am not sure I understand the issue here correctly. Camera movement should be independent of the POI placement on the map.

Could you provide screenshots or videos for us to better understand the issue?

ksi3321 commented 5 years ago

@atripathi-mb

Okay. So here is what I was able to do far.

I have 2 options to view the content. One is inside a 360 photosphere and other is in AR. I am using a script that uses gyro and compass to position the objects. I am using the AbstractMap prefab from Mapbox Samples along with the SpawnOnMap.cs script to display the POIs. The Map will not be visible in the scene. This is mainly used to display the POIs at the right coordinates. There is a toggle for switching between both views. Please see the attached screenshot of my initial configuration Screenshot 2019-11-15 at 10 49 42 AM I am not sure if this is the right thing to do but I changed the localScale of the map to (500, 100,500) for the photosphere view and (3000,100,3000) for the AR view since I felt the map is not in the proper "World Scale" size. This is what I get when I run the app. The photosphere works perfectly fine. But in the AR view, they appeared too close so I increased the scale of the map, still I have issues with the placement. Please see the screenshots here: ARView Photosphere

ksi3321 commented 5 years ago

Update: I tried removing all the scaling methods and changed scaling option to World Scale, the map shrunk down in size and became like this: IMG_0386

ukeOnFire commented 5 years ago

I'm sorry @maximus9600, but this is not a post with a solution, rather somewhat of a similar problem, I suppose. I cannot get objects being displayed that are further away than 1km. These are my settings of the ArAlignedMap: 157430644246400727

Please help, I've spent days on this and would like to stick to MapBox!

ksi3321 commented 5 years ago

hi @ukeOnFire Please adjust the field of view of your camera. Play around with the near and far planes to achieve what you want.

ukeOnFire commented 4 years ago

@maximus9600 thanks for coming back to me. I am playing around with the settings, without a lot of luck. imageedit_1_2619591692

Do you have another hint?

ksi3321 commented 4 years ago

@ukeOnFire Sorry for not getting back to you soon. How about setting the Near plane to 1000?