Placing objects at set locations in a pre-scanned room

随声附和 提交于 2019-12-10 11:38:55

问题


Objective: I have a pre-scanned spatial map of a room. (Carried out through an onboarding process.)

We take that map and add holographic locations/markers/digital twins to it in Unity, at pre-defined static locations. E.g wallspace, fittings, etc.

The app is then launched and contains all the holographic data in the correct location, irrespective of the users physical start location.

In short, I want an app to start, with pre-defined holograms at set locations in the real world, irrespective of where the app is started within that room.

I have read lots of tutorials and walkthroughs etc on Spatial Mapping, Spatial Understanding etc. but they do not seem to solve my problem.

I have already downloaded the 3D spatial map of the room using the hololens web browser interface, and placed holograms using Unity, with their respective scripts etc.

Now, when I start the app, all of the holograms are created correct relative to eachother, but they are only in the right place if I start the app stood at a set point, looking in a set direction.

The main idea has been to find the spatial anchors for the room, (I don't know where I get these from in the created spatial map!) and then once they are found, rotate/translate the holographic world to match the live scanned spatial anchors.

Other methods include: - placing all the objects manually in some config first-run of the app - creating qr codes and placing them in set locations to act in the same way as the spatial anchors in the main idea above.

Has anyone done this, and is there a better way of spawning pre-defined holograms at real-world locations every app run?

Other questions looking for similar answers, but not solving my use-case: https://forums.hololens.com/discussion/2938/position-independent-object-placement https://forum.unity.com/threads/how-do-i-refer-to-a-specific-space-in-a-spatial-mapped-room.425525/


回答1:


You will need to setup World anchors to let Hololens remember the position of holograms in your scanned space. (More info)

I tried it and this works pretty well.




回答2:


  • placing all the objects manually in some config first-run of the app

This is the easiest course of action you could take. Basically I would add a TapToPlace script to all of your Holograms that you want to anchor. When you first launch the app they will be in whatever place you have them in Unity. However, once you close the application and open it back up it will be in the same spot in which you put them. If you don't want the user to be able to move them so easily I would add some type of method that disables the TapToPlace with a button click or speech command.

You can find the TapToPlace script in the MRTK. This is a very easy way because you don't have to learn about Attaching and Removing World Anchors because it is done for you already.



来源:https://stackoverflow.com/questions/46950969/placing-objects-at-set-locations-in-a-pre-scanned-room

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!