The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Set a world anchor to Canvas
Hi to all,
I have 5 scenes in my hololens project and everytime I change the scene, the position of the scene changes. According to that I want to fix my canvas of the scene and I tried to use WorldAnchors but it isn't possible to attach a anchor to a canvas.
Is there another solution to prevent the scenes from changing their position after each scene load?
Greetings,
Chris
Best Answer
-
Optionsstepan_stulov ✭✭✭
Hey, @ChristophMarko
I have 5 scenes in my hololens project and everytime I change the scene, the position of the scene changes.
Scenes (in the sense of Unity scenes) have no concept of position. They're the top level container that everything else has a position in. Also Unity scenes are so broken beyond repair in so many ways that I'd refrain from switching the scenes as an in-app navigational mechanism altogether, but that's just me. Also, last time I checked, HoloToolkit was full of singletons which doesn't play too well with Unity's instantiation/serialization/scene management paradigms.
According to that I want to fix my canvas of the scene and I tried to use WorldAnchors but it isn't possible to attach a anchor to a canvas.
Is there another solution to prevent the scenes from changing their position after each scene load?The only thing anchors do, when applied to a game object, is take the sole responsibility of controlling that object's Transform component, namely its position and rotation. It can be that depending on the setup of your canvas there are other mechanisms controlling the same transform component, especially the canvas's renderMode. Make sure nothing interferes in that fashion, but also, just as @mark_grossnickle suggested, make the anchor control an empty container and move your canvas lower down the hierarchy. What's not helpful as well, is that canvas's transform is actually of the RectTransform subclass, not sure how anchors deal with that. You can also read more on the anchors in hierarchies.
Hope this helps.
Building the future of holographic navigation. We're hiring.
5
Answers
A couple thoughts:
What happens if you cycle through the scenes in Unity? Do the items more OR does the camera position change? Assuming each scene's camera is placed at 0,0,0 and the items within the scene do not move then you should be good. Anchoring is more for remote collaboration or saving and reloading a location.
If you do need to anchor a canvas then put the canvas as a child of the object with the anchor and make sure the canvas uses world space.
Taqtile
For my project I use the InputManager from the HoloToolKit. Each camera's position is set to (0,0,0). When I change the scene than the object will move more . to the left side. Is it possible that this issue comes from slightly head movements?
Hey, @ChristophMarko
Scenes (in the sense of Unity scenes) have no concept of position. They're the top level container that everything else has a position in. Also Unity scenes are so broken beyond repair in so many ways that I'd refrain from switching the scenes as an in-app navigational mechanism altogether, but that's just me. Also, last time I checked, HoloToolkit was full of singletons which doesn't play too well with Unity's instantiation/serialization/scene management paradigms.
The only thing anchors do, when applied to a game object, is take the sole responsibility of controlling that object's Transform component, namely its position and rotation. It can be that depending on the setup of your canvas there are other mechanisms controlling the same transform component, especially the canvas's renderMode. Make sure nothing interferes in that fashion, but also, just as @mark_grossnickle suggested, make the anchor control an empty container and move your canvas lower down the hierarchy. What's not helpful as well, is that canvas's transform is actually of the RectTransform subclass, not sure how anchors deal with that. You can also read more on the anchors in hierarchies.
Hope this helps.
Building the future of holographic navigation. We're hiring.