Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.

Why is my entire Unity game shifted up in the Y direction?

tarahtarah
edited October 2016 in Questions And Answers

I've hit quite the snag in a game I'm building for the HoloLens on Unity. I had a fully functional game, but when I tried to add new scenes for a start menu, it broke everything. As far as I can tell, I've reversed all the changes I've made, but I'm now encountering an issue I've never had before. The entire game itself is shifted up in the y direction even though the spatial mapping is accurate. I don't think the problem is with main camera because after the bug began, I deleted it and recreated it to be sure something strange wasn't applied (and the location is 0,0,0). Any ideas on what's going on? Has anyone encountered this before? As you can see from the first photo, that black bar across the screen is actually a plane that is supposed to be rendered at (0, .1, 3). On the second photo, the objects behind the mesh were previously just below it. I can provide more information/code if anyone needs. Thank you so much!

Answers

  • I don't quite follow what is the issue but if everything is shifted up along the Y and you are saying that the only difference is that you destroyed and recreated the camera then I'd say try shifting your camera along the y axis. it does not need to be at 0,0,0

    Taqtile

  • The bug was actually happening before I destroyed and recreated my camera, but I'll definitely try that. I destroyed and recreated because I was nervous I had accidentally clicked something weird. Thanks for the feedback!
  • Were you using Anchors at all before to lock your objects in the world?

  • edited October 2016

    Ok, I think I know your problem. When you create an empty Unity app, it puts main camera at 0,1, -10 but if you spawn a new camera, it appears at 0,0,0.

    Move your camera back to the default location and you should be good.

    I know you said it was happening before but double check the position. Without Anchors, Hololens places everything based on its offset from the camera, which it assumes is on your head of course.

  • Shifting the camera up 1 meter in the Y direction works somewhat. Sometimes when I do this, spatial mapping doesn't work past about 2 meters, which is a new bug, but that could very well be something different. It also seems to interfere with my cursor other times, but again, who knows if that is actually tied to the camera position? Having a camera position of 0, 1, -10 does not work because then all the holograms are 10 meters away. I am nervous about shifting camera position away from 0,0,0 because the official documentation says that HoloLens projects should have a camera position of 0, 0, 0. This seems like more of a bandaid than a solution (but hey, I'll take it if it won't cause any other problems!). Ideally, I would like to anchor the game objects to the ceiling and the floor, so implementing that could be a potential solution, as shifting would no longer occur in theory. Does anyone know how to do that?

  • UPDATE: I interned at Microsoft and I had a quick chat with a former team member (who worked on HoloLens before it was released) and he said to never change the camera from 0,0,0 for a HoloLens project. So I guess it's back to the drawing board on this issue...
  • If you change the camera's position it might cause weird behaviour, rotating objects might not always behave like in the editor, just for example. That's a unique thing that only applies to the HoloLens.

  • timgtimg mod
    edited October 2016

    are the objects that are rendering in the unexpected location children of another parent object? If so, what is transform.position of that object?

  • Unfortunately they are not. That black bar in the photo is a simple plane, which is at the root level of the hierarchy. I set the position in the inspector to be (0, 0.1, 3 ) and never modify it through scripts or otherwise. I would say, as a rough guess, it is rendering at (0, 1.5, 3). All of the gameObjects, which are for the most part at the root level, are also rendering about 1 meter higher than expected, which creates serious problems because they are above the ceiling and are occluded. They do shift down when the camera position is raised 1 meter, but as discussed earlier, this is not a good solution to the problem.

  • (0, 0.1, 3) is relative to where your hololens is at app startup (frame #1). Are you standing when you launch the app and then sitting :smile: ?

    Have you added a WorldAnchor to your hologram? Are you using the AnchorStore to restore it?

    You indicated above this started when you added scene(s) for a start menu. Are you still transitioning scenes? If so, how?

  • I am sitting the whole time and it renders above my head, which is what makes it so bizarre! I am not sure how to program a world anchor, so I have a feeling that might be what I need. All the resources I've found online for world anchors so far seem geared more towards users than developers. Ideally, I would anchor that plane just above the floor and anchor my other game objects to the ceiling. And I deleted those scenes immediately after they wrecked my game, but alas, the bugs remained. Haha!
Sign In or Register to comment.