mapbox / mapbox-unity-sdk

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

Mapbox AR placing an object on a LatLong #681

Closed tarakinsuide closed 6 years ago

tarakinsuide commented 6 years ago

Hello,

What tools/script should I use to display an AR object at a latlong using your SDK? I'm using your SDK for the first time and I didn't find proper resources in your documentation. If I use WorldScaleAR scene, what changes should I make to display an object at a latlong in my office?

Regards, Tarak Shah.

Note: If this is a bug or support ticket, please provide the following information:

tarakinsuide commented 6 years ago

Any step by step guide would be really helpful.

tboogh commented 6 years ago

There is an example in the zoomable map scene in the script SpawnOnMap.cs that spawns a prefab at a given location.

Hope that helps.

https://github.com/mapbox/mapbox-unity-sdk/blob/a450ad1a141bac5b54fbbde1eda4f9bf4cfffe03/sdkproject/Assets/Mapbox/Examples/2_ZoomableMap/Scripts/SpawnOnMap.cs

tarakinsuide commented 6 years ago

Also, do I need to make any changes to the WorldScaleAR scene to start rendering my camera? I built the example scene, but it shows only a blue and orange map instead of camera and the position of that is also not changing with respect to my phone's position.

tarakinsuide commented 6 years ago

Why is the upper screen not giving me camera feed and instead its showing me another 3D map? Look at the screenshot below:

worldscale manual

apavani commented 6 years ago

@tarakinsuide If you are on android, make sure you have checked the ARCore supported checkbox in the XR Setting section of Build Player Settings On iOS make sure that the Graphics API is set to Metal Let us know which platform you are building on The Map you see in the screenshot is a reference to give you a context of where on the map are you placed in AR.

tarakinsuide commented 6 years ago

Hi, Thanks! That worked. Now the issue is, why am I not able to see the Prefab at the LatLong where I want it to be inspite of giving manual location. I'm using WorldScaleAR ManualAlignment Scene. As per the screenshot attached below, the camera is now rendering, thanks to you. But, what is that map which is showing up along with camera feed called? Can I make changes to this map and make it more specific to my office surroundings, like by adding walls and hallways according to my office structure? How to do that? Can you please release a video tutorial?

screenshot_20180419-161251 screenshot_20180419-161411

apavani commented 6 years ago

I not able to see the Prefab at the LatLong where I want it to be inspite of giving manual location.

How did you do this? Can you share the code

For indoor map, we have this blog post that might help you. The project on that blog post has been developed with an older version of our SDK. So, I would highly recommend porting that work over to the our latest SDK so that we can help you better. Here's a guide on how to migrate to the latest SDK.

tarakinsuide commented 6 years ago

Hi Adarsh,

Which code should I share specifically? Should I share my Unity project here? For the screenshots that I sent earlier I've created a new project with Mapbox v1.4 and used WorldScaleAR-ManualAlignment scene. I added spawnOnMapScript and gave the latlongs and after building it gives me this map and I can also find prefabs on it now. The doubt is, can I get rid of the walls and plane scene that's being projected into AR? Also, I'll be giving location to my device with bluetooth beacons using other tools. So, where should I feed the new location that I'll get from my beacons data? Should I use LocationProvider to read the input data?

tarakinsuide commented 6 years ago

Here is the inspector view of my ArAlignedMap

inspector1 inspector2 inspector3

tarakinsuide commented 6 years ago

mapbox_issue I'm trying to remove or edit those blue building walls so that only the AR GameObject is visible to me, which in this case is a pink box.

doerrdude commented 6 years ago

Hi @tarakinsuide, you can disable the buildings from being rendered in the AbstractMap script in the editor by removing building Vector Layer Visualizer. I recommend reading these examples through to get a sense of the SDK's work flow: https://www.mapbox.com/unity-sdk/overview/city-simulator/

tarakinsuide commented 6 years ago

Thanks I tried it and the walls disappeared. But, now I can't change the manual position of my device. It always starts at the same point. Why?

doerrdude commented 6 years ago

Can you clarify? Do you mean the map location? If so, the map is spawning to the initial GPS location provided by the LocationProviderFactory. You can add your own location for the map to spawn into as you wish. Check the UpdateMap() method in the AbstractMap class.

tarakinsuide commented 6 years ago

No. Not the map location. I'm talking about the AR scene in the camera view. When the building layer was selected, the entire scene used to adjust accordingly to the changes with my manual position which I gave with a screen tap. But when I removed the building layer, the walls and buildings got disappeared, and when I tried to change the position of the marker to align to my current location, the scene did not change at all. It persisted in the same way when I had opened my camera.

What I want is, when I'm using manual alignment, the scene should also change according to the changes in my location that I'll provide on tap. Getting my point?

jordy-isaac commented 6 years ago

@tarakinsuide Have you tried to taking a look at the properties of the buildings in the vector layer visualizers? You can see what each setting does here. You can change the Extrusion Geometry Type to remove the walls only.

https://www.mapbox.com/unity-sdk/overview/data-explorer/#buildings

However, as mentioned in previous tickets, you'll face quite a bit of challenges with indoor mapping and the implementation will be up to you. Thanks for understanding!