facebookarchive/react-360

Using Scene in Chrome throws an error

nikgraf opened this issue · 2 comments

Description

Using Scene in Chrome throws an error. My code:

import React, { Component } from 'react';
import {
  AppRegistry,
  View,
  Scene,
} from 'react-vr';
import Tree from './components/Tree';

class World extends Component {
  render() {
    return (
      <View>
        <Scene />
      </View>
    );
  }
};

AppRegistry.registerComponent('hello_world', () => World);

Expected behavior

Scene should place the camera.

Actual behavior

An error is thrown

screen shot 2016-12-27 at 14 05 53

Logs

Scene.js:26 Uncaught ReferenceError: OVRUI is not defined
    at new RCTScene (Scene.js:26)
    at Array.Scene (UIManager.js:149)
    at UIManager.createView (UIManager.js:205)
    at ReactNativeContext.frame (ReactNativeContext.js:377)
    at Object.frame (createRootView.js:167)
    at VRInstance._frame (VRInstance.js:107)

Reproduction

Same as above

Additional Information

  "dependencies": {
    "ovrui": "~0.1.0",
    "ovr-audio": "~0.1.0",
    "react": "15.3.2",
    "react-native": "0.37.0",
    "three": "^0.80.1",
    "react-vr": "~0.1.0",
    "react-vr-web": "~0.1.0"
  }

Thanks @nikgraf, I'll take this and get back to you. It looks like we've missed an import not hit in our internal dev setup.

Not the same eventual feature set (Scene will be able to reference another node in the render hierarchy) but this gist will provide a good reference in creating a camera

  • place at root of render scene
  • transform of the camera specifies location of the camera in the scene (component handles inverse of matrix for you)
  • setState on camera doesn't force a render of children (https://github.com/reactjs/react-static-container)

Hope this helps