Open DYBDDY opened 1 month ago
Can you share a link that reproduce the issue? Make sure you are using A-Frame 1.6.0. If you want to position the camera in VR use a camera rig https://aframe.io/docs/1.6.0/components/camera.html#examples
The position was set in 2D mode,everything went will until entering vr mode,In developer mode after entering vr mode, I checked the rig position, it was as same as in 2d mode which were 0 1.264 2.704.However,it doesn't look like that. scene link
Not sure I understand. Can you elaborate what you get vs what you expect and provide some simple code to illustrate with Glitch: https://glitch.com/~aframe ?
Thanks
Thankyou for your response,I think image might tell you what I'm meaning. As you can see,the height in vr mode changed. I forgot to mention that I'm using "Immersive Web Emulator WebXR Emulator for Meta Quest devices" extension for chrome.
Expected angle(not in vr mode)
After enter VR mode
You have an extra </a-entity>
line 79 that shouldn't be there. Probably not related to your issue, but having mismatching end tags can do really weird things.
Ah your issue is that is doesn't stay at 1.264 in VR, yeah that's a feature, it uses the detected height in VR and override the y position of the rig. Not sure we can disable that behavior. If you don't have a rig does it overrides the y position while in VR?
Unfortunately if I remove rig the result stays the same,any other ways?
The camera represents the user's head. By default A-Frame will place it 1.6m above the ground to simulate a person standing. When entering VR the actual tracked position of the HMD is used instead. Since you can't control the physical position of the user's head, a camera rig needs to be used to move and position the user in the virtual world. The rig's position represents the point on the floor the user is standing on.
In other words, you should not use the rig to get the camera at the right eye-height, but only at the right location in the virtual world. The eye-height should be handled by the position of the camera entity when in 2D and the WebXR data when in VR.
There are two options depending on your needs, either:
local
instead of local-floor
(e.g. <a-scene webxr="referenceSpaceType: local">
)The first option has the benefit that you can ensure the virtual floor will match the physical floor of the user. In some cases it's more important to have the users head match a virtual position (e.g. simulating sitting while the user is actually standing or vice versa), in which case the second option should do what you need. Just be aware that the mismatch between physical floor and virtual floor can be confusing to some.
Either way, it's important that the scale of the virtual world matches real-life units. That is to say 1 unit should match 1 meter in your scene. Otherwise the virtual world will feel off, being either too large or too cramped.
Thanks for the response. If I take the first option , my rig was position="0 1.264 2.704",so I need to changed into position="0 -0.336 2.704" ?
If I take the first option , my rig was position="0 1.264 2.704",so I need to changed into position="0 -0.336 2.704" ?
Yes, that way when the default camera height of 1.6 is added it should work out to "0 1.264 2.807" in your scene. When entering VR this should roughly line up as well (when standing up-right). There will be slight differences as people naturally differ in height.
Note that this implies the (virtual) floor in your scene should be at y=-0.336. If it isn't the user might get the feeling they are floating (if the virtual floor is lower) or that their feet are sunken into the ground (if the virtual floor is higher). Whether that will be an issue varies from scene to scene, so best to just try it out and see.
Thanks for the help,I guess I have to think about it,appreciate your guide.
When entering VR mode, the Y-axis position of the camera is forcibly set to 1.7. I have tried modifying the code in aframe.min.js, but the result remains the same when entering VR mode.By the way I'm using meta quest 3.