I am creating a VR application with mrtk 2.1 and want to have the User on the same height when playing seated or standing. When Playing seated the camera is too low.
I could adjust the height of the MixedRealityPlayspace which contains the MainCamera, but that resets after using the teleport function. Additionally learned from this GitHub Post, that there is an Offset between the MainCamera and MixedRealityPlayspace which is not accessible via mrtk so calculating the right height would be difficult. This just does not seem like the right approach.
How can I make sure that the User is always on the right head height in game even when playing seated?
OK i found a solution that works for me. I use the following code to move the mixedRealityPlayspace up or down to achieve the wanted player height.(if you want to use this make sure to tag your mixedRealityPlayspace GameObject "Player")
var mixedRealityPlayspace = GameObject.FindGameObjectsWithTag("Player")[0].transform;
var camHeight = mainCamera.transform.position.y;
var adjustement =wantedPlayerHeight-camHeight ;
mixedRealityPlayspace.position= new Vector3(mixedRealityPlayspace.position.x,mixedRealityPlayspace.position.y+adjustement, mixedRealityPlayspace.position.z);
I call this on ones on the start of my Scene and in the OnTeleportCompleted Event described in this Dokumentation for the MRTK Teleport system