Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teleporting up and down changes base height #1181

Closed
Alexees opened this issue Oct 17, 2017 · 6 comments
Closed

Teleporting up and down changes base height #1181

Alexees opened this issue Oct 17, 2017 · 6 comments
Assignees

Comments

@Alexees
Copy link
Contributor

Alexees commented Oct 17, 2017

Changing heights by teleporting onto colliders with different heights eventually changes the overall base height. This results in floating in air or stuck in the ground. It's not very predictable when this happens (last time it worked properly 3 times teleporting, but failed the forth time trying to get from a sofa onto the floor and staying at sofa level)

@amrittb
Copy link

amrittb commented Oct 17, 2017

Having the same problem. Needs a Body Physics implementation similar to that of VRTK Body Physics.

@keveleigh
Copy link
Contributor

Ahh, hmm. The attempt at preserving height during a teleport is done by raycasting straight down from the camera right before the teleport. I could see a situation where you've teleported on top of a taller object, moved your head to no longer be directly over the object, and then teleported again, which would raycast past the object and back to the floor (or otherwise something at a different height).

A better height detection method would be preferable. Thinking about it, an app in RoomScale might no longer need to check height, since Y = 0 becomes real-world floor level. Stationary space-type apps will still need something though.

@Alexees
Copy link
Contributor Author

Alexees commented Oct 18, 2017

If its true that a raycast from the head measures the height every time a teleport occurs, then I'm wondering why, once the height is off, it stays off?

@keveleigh
Copy link
Contributor

keveleigh commented Oct 18, 2017

Once you teleport and your head stays at that (wrong) height, you're now that height above the floor (or whatever you teleported on). Any subsequent teleports/raycasts will calculate the same height.

@Alexees
Copy link
Contributor Author

Alexees commented Oct 30, 2017

Just one question. Will it be or is it possible to get the height of the HMD above the ground from windows? Or is that something you guys are working on?
I would think that the headset itself has an altitude value based on the inside out tracking of the device. It shouldn't be any more than elevating the head by that amount up from the teleported position, should it?

@Alexees
Copy link
Contributor Author

Alexees commented Nov 3, 2017

Ok, I fixed the height issue by changing two methods in MixedRealityTeleport.cs:

public void SetWorldPosition(Vector3 worldPosition)
        {
            // There are two things moving the camera: the camera parent (that this script is attached to)
            // and the user's head (which the MR device is attached to. :)). When setting the world position,
            // we need to set it relative to the user's head in the scene so they are looking/standing where 
            // we expect.
            Vector3 newPosition = worldPosition - (CameraCache.Main.transform.position - transform.position);
			newPosition.y = worldPosition.y;
			transform.position = newPosition;

		}

        private void FinishTeleport()
        {
            if (currentPointingSource != null)
            {
                currentPointingSource = null;

                if (isTeleportValid)
                {
                    fadeControl.DoFade(0.25f, 0.5f, () =>
                    {
                        SetWorldPosition(teleportMarker.transform.position);
                    }, null);
                }

                DisableMarker();
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants