- Home /
VR camera Positioning on a plan view of the building ???
Hello guys,
I am a building visualizer and new in Unity VR.
I am going to build an move-able VR app to visualize the interior of a building. The VR immersion can be moved from room to room with the control in Google cardboard. I would like to put another view on the scene to show the position of the VR camera on the plan of the building in order for the user can identify where the user is in the building. But I have no idea how to do in VR cardboard.
You can see the attached image for better understanding the app working.
Unity : 2017.3
VR platfrom : Google cardboard
Could any professional give me the advice for that ?
Best Regards,
Answer by Harinezumi · May 03, 2018 at 07:55 AM
This is basically the same as a minimap functionality. Looking up questions about minimap will help you. A rough outline on how to do it:
- have a texture with your plan
- map the user's XZ position to a position on the plan rectangle
- rotate the position marker object according to the view angle
Basically get the XZ extents of your 3D environment (map it so the low limit is 0). Then you can divide your user/camera position with the extents, which will give you the position in the textured rectangle (range [0, 1]). Then you need to map this position to the screen again using the rectangles position and size. Then you use Mathf.Atan2()
to get the rotation of the camera relative to a direction (I recommend Vector3.forward
), and use that angle to rotate the player marker symbol.
I guess the easiest would be to use Unity UI for this, however, 2D UIs don't look very nice in VR, they seem to "fall off" the view. Anyway, this is a good start, you can improve the visuals once you have it working.
Answer by WorldEater · May 03, 2018 at 01:01 PM
This could be done in many different ways, I would probably compare the players x and z position with the dimensions of the virtual appartment. so playerpos / size of room to get a float between zero and one for the x and z axis. Then create a world space ui with the overview over the apartment and place the player marker using the values you calculated.
If you need examples of ui for vr check out this link: https://unity3d.com/learn/tutorials/topics/virtual-reality/user-interfaces-vr
Good luck.
Answer by HungLam · May 08, 2018 at 04:26 AM
Thanks a lot, I got some Youtube videos about VR mini map.
Your answer
![](https://koobas.hobune.stream/wayback/20220612161535im_/https://answers.unity.com/themes/thub/images/avi.jpg)