Rotate an entity to face towards another entity in A-Frame
npm install aframe-look-at-componentA component for A-Frame to tell an entity to face towards
another entity or position. Uses three.js's
Object3D .lookAt()
The look-at component defines the behavior for an entity to dynamically rotate
or face towards another entity or position. The rotation of the entity will be
updated on every tick. The look-at component can take either a vec3 position
or a [query selector][mdn-queryselector] to another entity.
| Type | Description |
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| selector | A query selector indicating another entity to track. If the other entity is moving then the look-at component will track the moving entity. |
| vec3 | An XYZ coordinate. The entity will face towards a static position. |
#### Browser Installation
Install and use by directly including the browser files:
``html
#### NPM Installation
Install via NPM:
`bash
npm install aframe-look-at-component
`Then register and use.
`js
require('aframe');
require('aframe-look-at-component');
``[mdn-queryselector]: https://developer.mozilla.org/docs/Web/API/Document/querySelector