ngokevin
ngokevin

Reputation: 13233

How to access the scene from within a component in A-Frame?

How to get the scene, from within a component .init() function in A-Frame?

AFRAME.registerComponent('foo', {
  init: function () {
    // ?
  }
});

Upvotes: 1

Views: 1714

Answers (1)

ngokevin
ngokevin

Reputation: 13233

https://aframe.io/docs/0.4.0/core/component.html#component-prototype-properties

AFRAME.registerComponent('foo', {
  init: function () {
    console.log(this.el.sceneEl);
  },

  update: function () {
    console.log(this.el.sceneEl);
  }
});

Upvotes: 3

Related Questions