virtual-realityreact-360

React360 Entity example


I am trying to use a 3d object in a react360 project. I followed the steps in setup docs. Created a project with react-360 init Hello360 command and started the server with npm start.

Also, downloaded this obj model, and put it into static_assets folder. Then, put an Entity tag into index.js for displaying the object. Whole index.js is as follows.

import React from 'react';
import {
  AppRegistry,
  Entity,
  asset
} from 'react-360';

export default class Hello360 extends React.Component {
  render() {
    return (
      <Entity source={{ obj: asset('stickman.obj') }} />
    );
  }
};

AppRegistry.registerComponent('Hello360', () => Hello360);

As a result, I can't see anything in the browser but the background image. What am I doing wrong?


Solution

  • React360 docs Entity page is missing the import part. Importing Entity as in this blog solves the problem.

    import React from 'react';
    import {
      AppRegistry,
      asset,
    } from 'react-360';
    
    import Entity from 'Entity';
    
    ...