MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

MixedRealityTeleport teleport position is abnormal

Open jerrygg opened this issue 8 years ago • 4 comments

Overview

When the Stay on the floor attribute in MixedRealityTeleport is not checked, the teloport postion is abnormal.

      public void SetWorldPosition(Vector3 worldPosition)
        {
            var originalY = transform.position.y;
            // 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.
            var newPosition = worldPosition - (CameraCache.Main.transform.position - transform.position);
            if (StayOnTheFloor)
            {
                newPosition.y = originalY;
            }
            transform.position = newPosition;      ------→   Should add body height
        }

Expected Behavior

Teloport to above target

Actual Behavior

Teloport the head to the target position, the body is below the ground

Steps to reproduce

1.Open HoloToolkit-Examples GrabMechanics.Scenes 2.Uncheck Stay on the floor of MixedRealityTeleport

Mixed Reality Toolkit Release Version

Master

jerrygg avatar Jun 29 '18 06:06 jerrygg

Hrm, I'll take a look at this. Body height should be accounted for in (CameraCache.Main.transform.position - transform.position);.

keveleigh avatar Jun 29 '18 15:06 keveleigh

@keveleigh var newPosition = worldPosition - (CameraCache.Main.transform.position - transform.position); This calculated result newPosition .y <0 ,This camera is close to the ground. You can try.

jerrygg avatar Jul 02 '18 07:07 jerrygg

I'm not able to repro this. In step 2 under Steps to reproduce, "Stay on the floor" is already unchecked in the Grab Mechanics scene, and the teleport works as expected for me.

I've opened #2405 though with a slight rework of the teleportation logic. Please take a look and let me know if it resolves what you've been seeing.

keveleigh avatar Jul 06 '18 00:07 keveleigh

I found the problem because I added a CapsuleCollider to my camera. @keveleigh

jerrygg avatar Jul 06 '18 02:07 jerrygg