NOTE: This version of the documentation tracks unstable development happening on A-Frame’s
masterbranch. If you wish to try it out, grab the unstable build. Otherwise, head to the documentation for the current 0.7.0 version
The camera component defines from which perspective the user views the scene. The camera is commonly paired with controls components that allow input devices to move and rotate the camera.
A camera situated at the average height of human eye level (1.6 meters).
|active||Whether the camera is the active camera in a scene with more than one camera.||true|
|far||Camera frustum far clipping plane.||10000|
|fov||Field of view (in degrees).||80|
|near||Camera frustum near clipping plane.||0.005|
|userHeight||Height offset to add to the camera when not in VR mode so the camera is not on ground level. The default camera that A-Frame injects or the
|zoom||Zoom factor of the camera.||1|
If a camera is not specified, A-Frame will inject a default camera:
If a camera is specified (e.g., our own
then the default camera will not be added.
When not in VR mode,
userHeight translates the camera up to approximate
average height of human eye level. The injected camera has this set to 1.6
(meters). When entering VR, this height offset is removed such that we used
absolute position returned from the VR headset. The offset is convenient for
experiences that work both in and out of VR, as well as making experiences look
decent from a desktop screen as opposed to clipping the ground if the headset
was resting on the ground.
When exiting VR, the camera will restore its rotation to its rotation before it entered VR. This is so when we exit VR, the rotation of the camera is back to normal for a desktop screen.
active property gets toggled, the component will notify the camera system
to change the current camera used by the renderer:
To fix entities onto the camera such that they stay within view no matter where the user looks, you can attach those entities as a child of the camera. Use cases might be a heads-up display (HUD).
Note that you should use HUDs sparingly as they cause irritation and eye strain in VR. Consider integrating menus into the fabric of the world itself. If you do create a HUD, make sure that the HUD is more in the center of the field of view such that the user does not have to strain their eyes to read it.