<p dir="auto">Hi<br>
First I would like to point out that the documentation for WebXRManager has missing functions that are there in the source but not mentioned in the documentation. Not sure how you want to tackle this as in the source there is no comments about what these extra functions do. The webxr section could benefit of some more docu.</p>
<p dir="auto">I was in the need of getting the fov of the AR camera when in immersive-ar mode in WebXR and stumbled upon WebXRManager.getCamera(). Some tutorial say that this is the AR/VR camera that is used.<br>
On my phone it reports a fov of 50 always (once you enter AR mode). Which is not right. So what is this function supposed to do?</p>
<p dir="auto">I ended up calculating the fov like so once a XRFrame was available.<br>
Do you propose a different solution? You could add a function to WebXRManager that has the below code.<br>
I dont know what the getCamera function does in VR mode, maybe it works but in AR mode i dont think it works as expected.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="   let ref= this.renderer.xr.getReferenceSpace();
            let pose= frame.getViewerPose(ref);
            if (pose) {
            let fovi = pose.views[0].projectionMatrix[5];
            const fov = Math.atan2(1, fovi) * 2 * 180 / Math.PI;
            console.log(fov);
            }"><pre class="notranslate">   <span class="pl-k">let</span> <span class="pl-s1">ref</span><span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">renderer</span><span class="pl-kos">.</span><span class="pl-c1">xr</span><span class="pl-kos">.</span><span class="pl-en">getReferenceSpace</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-k">let</span> <span class="pl-s1">pose</span><span class="pl-c1">=</span> <span class="pl-s1">frame</span><span class="pl-kos">.</span><span class="pl-en">getViewerPose</span><span class="pl-kos">(</span><span class="pl-s1">ref</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">pose</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
            <span class="pl-k">let</span> <span class="pl-s1">fovi</span> <span class="pl-c1">=</span> <span class="pl-s1">pose</span><span class="pl-kos">.</span><span class="pl-c1">views</span><span class="pl-kos">[</span><span class="pl-c1">0</span><span class="pl-kos">]</span><span class="pl-kos">.</span><span class="pl-c1">projectionMatrix</span><span class="pl-kos">[</span><span class="pl-c1">5</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
            <span class="pl-k">const</span> <span class="pl-s1">fov</span> <span class="pl-c1">=</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-en">atan2</span><span class="pl-kos">(</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-s1">fovi</span><span class="pl-kos">)</span> <span class="pl-c1">*</span> <span class="pl-c1">2</span> <span class="pl-c1">*</span> <span class="pl-c1">180</span> <span class="pl-c1">/</span> <span class="pl-v">Math</span><span class="pl-kos">.</span><span class="pl-c1">PI</span><span class="pl-kos">;</span>
            <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">fov</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
            <span class="pl-kos">}</span></pre></div>
<p dir="auto">Thanks<br>
Dimi</p>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">The VR camera always returns a FOV of 50 degrees, which is not necessarily the actual FOV. Using Cardboard, for example, the field of view is a lot higher.</p>
<p dir="auto">It can be tested in <a href="https://threejs.org/examples/webvr_cubes.html" rel="nofollow">this example</a> using the code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="renderer.vr.getCamera(camera).fov"><pre class="notranslate"><span class="pl-s1">renderer</span><span class="pl-kos">.</span><span class="pl-c1">vr</span><span class="pl-kos">.</span><span class="pl-en">getCamera</span><span class="pl-kos">(</span><span class="pl-s1">camera</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">fov</span></pre></div>
<p dir="auto">If this value is not meant to be used (because the view is distorted rather differently from a regular perspective camera), maybe that property should return -1 to indicate this.</p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r88</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> ...</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> macOS</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> iOS</li>
</ul>
<h5 dir="auto">Hardware Requirements (graphics card, VR Device, ...)</h5>
<p dir="auto">Used Cardboard. but the VR emulation extension for Chrome behaves the same way.</p>