Note: This documentation is for the old 0.7.0 version of A-Frame. Check out the documentation for the current 1.5.0 version
The look-controls component:
- Rotates the entity when we rotate a VR head-mounted display (HMD).
- Rotates the entity when we click-drag mouse.
- Rotates the entity when we touch-drag the touchscreen.
The look-controls component is usually used alongside the camera component.
<a-entity camera look-controls></a-entity>
|Whether look controls are enabled.
|Whether to use VR headset pose in VR mode.
|Whether to reverse mouse drag.
|Whether standing mode is enabled (passed to
|Whether to use touch controls in magic window mode.
While A-Frame’s look-controls component is primarily meant for VR with sensible defaults to work across platforms, many developers want to use A-Frame for non-VR use cases (e.g., desktop, touchscreen). We might want to modify the mouse and touch behaviors.
The best way to configure the behavior is to copy and customize the current look-controls component code. This allows us to configure the controls how we want (e.g., limit the pitch on touch, reverse one axis). If we were to include every possible configuration into the core component, we would be left maintaining a wide array of flags.
The component lives within a Browserify/Webpack context so you’ll need to
require statements with A-Frame globals (e.g.,
AFRAME.constants.DEFAULT_CAMERA_HEIGHT), and get rid of the
If you want to create your own component for look controls, you will have to copy and paste the HMD-tracking bits into your component. In the future, we may have a system for people to more easily create their controls.