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

Mapbox AR placing an object on a LatLong

Open tarakinsuide opened this issue 8 years ago • 15 comments

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:

  • Unity version:
  • Mapbox SDK version:
  • The platform you're building to:
  • A description of what you're trying to do:
  • Steps to recreate the bug if appropriate:
  • Links to your logs are also helpful:

tarakinsuide avatar Apr 17 '18 11:04 tarakinsuide

Any step by step guide would be really helpful.

tarakinsuide avatar Apr 17 '18 11:04 tarakinsuide

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

tboogh avatar Apr 18 '18 06:04 tboogh

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 avatar Apr 18 '18 13:04 tarakinsuide

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

tarakinsuide avatar Apr 19 '18 07:04 tarakinsuide

@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.

apavani avatar Apr 19 '18 07:04 apavani

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

tarakinsuide avatar Apr 19 '18 11:04 tarakinsuide

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.

apavani avatar Apr 20 '18 00:04 apavani

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 avatar Apr 20 '18 06:04 tarakinsuide

Here is the inspector view of my ArAlignedMap

inspector1 inspector2 inspector3

tarakinsuide avatar Apr 20 '18 08:04 tarakinsuide

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.

tarakinsuide avatar Apr 24 '18 09:04 tarakinsuide

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/

doerrdude avatar Apr 24 '18 10:04 doerrdude

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?

tarakinsuide avatar Apr 24 '18 15:04 tarakinsuide

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.

doerrdude avatar Apr 24 '18 16:04 doerrdude

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?

tarakinsuide avatar Apr 24 '18 16:04 tarakinsuide

@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!

jordy-isaac avatar Apr 26 '18 15:04 jordy-isaac