Search code examples
aframe

Get the camera angle of aframe


I have a project and I want it to run on a PC or a mobile terminal, but different devices have different initial visible areas of the camera. How can I get this angle? For example, camera.fov defaults to 80, but it may actually only be 50 on the mobile terminal. How can I accurately obtain my current visual range?


Solution

  • It's hard to know without a link to code, but here's a simple way to get FOV from an A-Frame scene.

    For example, on this scene: https://aframe.glitch.me/

    You can open the console and type:

    > AFRAME.scenes[0].camera.fov
    

    And you'll get an answer such as:

    > 80