Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use "AFRAME.registerGeometry"? #125

Closed
ex-tag opened this issue Feb 14, 2019 · 1 comment
Closed

How to use "AFRAME.registerGeometry"? #125

ex-tag opened this issue Feb 14, 2019 · 1 comment

Comments

@ex-tag
Copy link

ex-tag commented Feb 14, 2019

How do I register a geometry? Trying to use AFRAME.registerGeometry...

'AFRAME' is not defined
import 'aframe';
import 'aframe-extras';
import 'aframe-particle-system-component';
import 'aframe-gradient-sky';
import { Scene, Entity } from 'aframe-react';
import React, { Component, Fragment } from 'react';
import { BoxGeometry } from 'three';

AFRAME.registerGeometry('box', {
  schema: {
    depth: { default: 1, min: 0 },
    height: { default: 1, min: 0 },
    width: { default: 1, min: 0 },
    segmentsHeight: { default: 1, min: 1, max: 20, type: 'int' },
    segmentsWidth: { default: 1, min: 1, max: 20, type: 'int' },
    segmentsDepth: { default: 1, min: 1, max: 20, type: 'int' }
  },
  init: data => {
    this.geometry = new BoxGeometry(data.width, data.height, data.depth);
  }
});
@samuel-zuk
Copy link

include this at the top of your code:
const AFRAME = window.AFRAME;

@ex-tag ex-tag closed this as completed Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants