Note: This documentation is for the old 0.2.0 version of A-Frame. Check out the documentation for the current 0.6.0 version
The camera primitive places the user somewhere within the scene. It is an entity that prescribes the camera component with mappings to controls-related components.
|Attribute||Component Mapping||Default Value|
To position the camera, set the position on a wrapper
<a-entity>. Don’t set the position directly on the camera primitive because controls will quickly override the set position:
When we use the camera primitive, A-Frame will not prescribe a default camera.
Note the default camera is positioned at
0 1.8 4 whereas the camera primitive will be positioned at
0 0 0. In the example below, we would see a box:
But if we prescribe our own camera and do not adjust its position:
Then both the cube and camera wll be positioned at
0 0 0, the camera will be inside the cube, and thus the box won’t be visible without moving the camera. So make sure the have the camera well-positioned.
We can use the look-at component to make another entity rotate towards the user:
Whenever the user (and thus the camera) moves, then the entity will update its rotation.