XRTK / com.xrtk.core

The Official Mixed Reality Framework for Unity
https://xrtk.io
MIT License
308 stars 34 forks source link

Scene content is offset depending on the platform #42

Closed StephenHodgson closed 4 years ago

StephenHodgson commented 5 years ago

When building for the HoloLens vs a VR headset, generally the scene content will be offset depending on where the camera starts.

There is a strong need to adjust the user's start position depending on the platform.

Requirements

Additional Context

Alexees commented 5 years ago

about the y position. do you guys have contact to the other guys who are responsible for the MR Portal? since the beginning, the player height needed to be hard coded in unity cause there is no height reading from the portal. I'm 1,93 meters tall, that's probably not what most applications have configured.

genereddick commented 5 years ago

In the HoloToolkit there is the SceneContentAdjuster, but it had to be set for each parent gameobject / scene. It would be nice to have something that is set once and applied universally.

Alexees commented 5 years ago

The SceneContentAdjuster is not quite what i had in mind. the perfect case would be that Unity moved all geometry, even static geometry down as far as the mixed reality portal tells it how tall the person wearing the hmd is. this would need a change in the engine source. that's the only way I think there is if you want to move lens and HMD wearing persons to eye level . the only other solution would be moving the Hololens up, but I don't think the lens knows how high above floor level it is. all of this ignoring networked objects of course. the point is, the portal knows how high above floor level the hmd is but does not pass this info into the engine for reading.

StephenHodgson commented 5 years ago

the only other solution would be moving the Hololens up, but I don't think the lens knows how high above floor level it is.

That one is a bit tougher. I think it might be easier just to adjust the HMD to zero after it's offset is set by the engine at start.

Alexees commented 5 years ago

what about virtual floors? how far below the hmd would you put them? 1,93 meters, like I am? ;)

StephenHodgson commented 5 years ago

I don't think I understand what you mean about the virtual floors. Could you explain?

Alexees commented 5 years ago

If not otherwise configured, the HMD player will start with its head at Vector3.zero by default. But since he is virtual, he needs a reference floor. This floor is his estimate about his personal body height and that is of course different between people. So unless one let the player configure his personal height in the final application, you need some average height like 1,70 meters or something to put the floor SOMEWHERE. If Unity were to read the reading from the MR Portal, this would be much easier and as accurate as the portal tracks the HMD. It calculates the HMD above ground position, while Unity does not receive this hight info.

StephenHodgson commented 5 years ago

If Unity were to read the reading from the MR Portal, this would be much easier and as accurate as the portal tracks the HMD

I'm pretty sure that's how the toolkit works atm. I was just going to adjust the playspace to recenter the HMD back to the spawn point. I think we just have to do this for xr devices that support Unity's boundaries.

Alexees commented 5 years ago

i might not have been clear enough. if you want to level a Hololens with an HMD, you'd need to know where the floor is. unity knows where the head is at any given time, but NOT where the floor is at since it does not know if I'm kneeling or something. currently the best way to offset the floor would be to use the first reading unity gets from the headset. is it's still not clear I could make a drawing

StephenHodgson commented 5 years ago

Let's try to break down the sequence of events ( drawing might be helpful! 😄 )

HoloLens / AR / Standalone is fairly easy as the Camera just starts at the origin.

HMD:

  1. Camera is at origin (0,0,0)
  2. Unity gets event where head position is located and moves the camera up on the y position
  3. Boundary System or some other script moves the Playspace back down so the camera is kinda back at the origin (0,0,0) but this doesn't have to be exact.
Alexees commented 5 years ago

thats about the only way possible at the moment, yes. what bothers me is that you cannot create levels with static geometry like this. would be awesome performance wise, but unity just does not provide the necessary API for this :(