no-click-look-controls
ComponentIntuitive camera controls for desktop 3D experiences with A-Frame.
look-controls
component.User interface with restricted view angles to focus user on content.
<html>
<head>
<!-- A-Frame standard library if needed -->
<script src="https://aframe.io/releases/latest/aframe.js"></script>
<!-- Component (includes A-Frame core) -->
<script src="https://github.com/alexrkass/aframe-no-click-look-controls/raw/master/dist/aframe-no-click-look-controls.min.js"></script>
</head>
<body>
<a-scene>
<!-- ... -->
<a-entity camera no-click-look-controls="[options]"></a-entity>
</a-scene>
</body>
</html>
Install.
$ npm install aframe-no-click-look-controls
Register.
var AFRAME = require('aframe-core');
var NoClickLookControls = require('aframe-no-click-look-controls');
AFRAME.registerComponent('no-click-look-controls', NoClickLookControls);
Use.
(units are radians)
Property | Default | Description |
---|---|---|
maxyaw | 3π | Controls the max y-axis rotation. Actual max viewing angle is twice the parameter, ie 3π is 3π to the right and 3π to the left. |
maxpitch | π/2 | Controls the max x-axis rotation. Actual max viewing angle is twice the parameter, ie π/2 is π/2 up and π/2 down. |
enabled | true | Enables controls |
allow asymmetrical yaw and pitch values rather than forcing symmetrical distances from original camera position
add option to slow down camera rotation as the mouse gets closer to the edge of the canvas
write tests
add a tiny touch of motion smoothing