MixedRealityTeleport teleport position is abnormal
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
Hrm, I'll take a look at this. Body height should be accounted for in (CameraCache.Main.transform.position - transform.position);.
@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.
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.
I found the problem because I added a CapsuleCollider to my camera. @keveleigh