look-at

Note: This documentation is for the old 0.2.0 version of A-Frame. Check out the documentation for the current 1.6.0 version

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 to another entity.

Example applications might include having a monster stare at the player:

<a-entity id="monster" geometry="primitive: box" material="src: monster.png"
look-at="[camera]"></a-entity>

<a-entity id="player" camera></a-entity>

Or maybe having a dog look at a running squirrel:

<a-entity id="dog" geometry="primitive: box" material="src: dog.png"
look-at="#squirrel"></a-entity>

<a-entity id="squirrel">
<a-animation id="running" attribute="position" to="100 0 0"></a-animation>
</a-entity>

Possible Values

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.