My XR scene is standing grounded by default, but I have a VehicleBody3D that the player can enter. On entering the vehicle I then want to fix the players camera height so they appear seated in the correct place for the vehicle, but the XR rig overrides any translations. Is there an easy way to stop this when in the vehicle?
I’ve tried setting the player_calibrate_height to false and motion_mode to floating but neither has any effect.
Seeing you mention player_calibrate_height I’m assuming you are using XR Tools and are using the normal player setup in XR Tools.
This setup is designed only for games where the player character is standing up, with all movement controls and body interactions setup for that scenario.
In a situation where the player character is seated inside of a vehicle you would setup a different player rig where the XROrigin3D node is placed where the player head should be, and the XRCamera3D node allows free movement of the players head from that reference point.
You then either change the xr_play_area_mode to XR_PLAY_AREA_SITTING or call XRServer.center_on_hmd to ensure the rig behaves properly (for a game where you switch I recommend leaving the xr_play_area_mode alone and use center_on_hmd to switch between standing and seated play modes, it’s more predictable).
Switching between rigs is a matter of which XROrigin3D and XRCamera3D node is marked as active, though I highly recommend removing your standing player rig from your scene while in sitting mode and visa versa to prevent mishaps due to collision objects staying active or other unforeseen issues.
Thanks that works good enough for the moment. I have a unique situation though. This isn’t for a game, but for company trade show events whereby the player may be seated or standing depending on the physical environment available. So ideally I would want to use the HMD real height with an offset so that if they are sitting down (for comfort) they would appear standing in the virtual scene (lunar surface). But if they then choose to enter a vehicle rover I would need to change the offset so they then appear seated. It would also be nice to take over the camera position and smoothly move into the vehicle rather than snap between the 2 rigs. I’ll have a go at this when I have more time but this solution is great for now.
When you look at the user sitting down, but playing a character that is standing up, that is what the height adjustment in XR tools is all about. By default it’s set to auto adjust, which basically means that when your scene loads in, it checks the current height of the players head, and makes an adjustment so that the character is standing up.
When you look at the transition you’re suggesting, you can move the XROrigin3D point along a path that brings the players head to the right position, and then switch rigs.
However I highly recommend you don’t go down this path, unless you want your trade show attendees puking on the floor, or at the very least get very disoriented and loose their balance.
The worse thing you can do in VR is introduce motion that the user doesn’t feel , especially rotational motion of the sort you need when a user moves from standing next to a vehicle, to sitting in the seat looking forward.
This is the achilles heel of VR. It may seem less nice but a good old fade out and fade in, will keep your users from getting nauseated.