aframe Entities Retrieving an Entity components


Example

For example, if we wanted to grab an entity’s three.js camera object or material object, we could reach into its components

var camera = document.querySelector('a-entity[camera]').components.camera.camera;
var material = document.querySelector('a-entity[material]').components.material.material;

Or if a component exposes an API, we can call its methods:

document.querySelector('a-entity[sound]').components.sound.pause();