This question is updated. I upgraded to the new Unity XR Interaction Toolkit 3.0.
This problem is very simple to reproduce:
- Create a new Unity VR project using the VR 3.0 template.
- Open the BasicScene that has only a XR Origin (XR Rig).
- Ajust the character controller capsule collider height and y position, and the camera offset.
- Run the game.
You will now see that the height and y position (and camera offset) are ignored in the game. Our player character is always forced to be 1.3 meters tall.
Why is this and how should we adjust the height of the player character ?
I have not changed anything in the default settings from the VR template. Setting the camera origin to floor or setting it manually also makes no difference.
I’m having this issue too. It works on the editor and simulator, but on the device the values seem to be overridden.
I guess it makes sense that the height of the character controller should be the same as your own physical body height, otherwise the scene could become unnatural/nauseating. But for testing purposes it’s a bit clumsy that you have to stand up from your desk every time.
I had the same problem, and I think you just have to set the Tracking Origin Mode to Device if you don’t want it to override the values of the CharacterController.
Then, to adjust for seated play, you can do something like this: How to offset camera height using the XR Interaction Toolkit for seated game
I ended up doing it like this:
void ResetCameraPosition()
{
float yDiff = charCtrl.height - Camera.main.transform.position.y;
xrOrigin.CameraYOffset += yDiff;
Debug.Log($"Resetting camera height to {Camera.main.transform.position.y}", this);
}
The camera’s TrackedPoseDriver always seems to take control of its position, and I couldn’t find a way to override it, but I think (hope) it’s sufficient to just move the y offset instead. This way, you can set the player’s height to any value of real-world units, and it’ll be relative to the headset’s current position, regardless of whether they’re standing or sitting.
2 Likes
This is a good approach if you must control the character controller’s height.
I’d recommend against trying to play with the height however. If you do you won’t get a properly calibrated floor plane between the virtual and real floor.
If that doesn’t matter however, then yes, setting to device mode is the right approach.
1 Like