(moved to ngokevin/kframe) look-at component for A-Frame.
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Richard Lewis e1c5cce7dc Merge pull request #1 from matrix-org/isCoordinateBuild
Fix isCoordinate function name
2017-03-24 17:56:54 +00:00
dist Bump build 2017-03-24 17:50:05 +00:00
examples look at this 2016-05-10 16:48:53 -07:00
scripts look at this 2016-05-10 16:48:53 -07:00
.gitignore look at this 2016-05-10 16:48:53 -07:00
index.js Update isCoordinate to match aframe name change to isCoordinates 2017-03-24 17:37:51 +00:00
LICENSE look at this 2016-05-10 16:48:53 -07:00
package.json bump aframe 2016-08-21 16:42:49 -07:00
README.md note move to kframe 2016-10-03 10:38:42 -07:00

aframe-look-at-component

MOVED TO ngokevin/kframe

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

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.

Usage

Browser Installation

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.2.0/aframe.min.js"></script>
  <script src="https://rawgit.com/ngokevin/aframe-look-at-component/master/dist/aframe-look-at-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity id="monster" geometry="primitive: box" material="src: url(monster.png)"
              look-at="[camera]"></a-entity>
    <a-entity id="player" camera></a-entity>

    <a-entity id="dog" geometry="primitive: box" material="src: url(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>
  </a-scene>
</body>

NPM Installation

Install via NPM:

npm install aframe-look-at-component

Then register and use.

require('aframe');
require('aframe-look-at-component');