1

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?

Alperen
  • 3,772
  • 3
  • 27
  • 49

1 Answers1

1

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';

...
Alperen
  • 3,772
  • 3
  • 27
  • 49
  • Are you sure, docs are incorrect? Very strange. If yes, you should raise a concern with the community. – ravibagul91 Sep 16 '19 at 09:48
  • "Incorrect" was not the proper word for the situation. Actually, there is no code sample in that doc page for importing Entity. I edited my answer. I guess, [the community is aware of the problem](https://github.com/facebook/react-360/issues/501#issuecomment-392835045). – Alperen Sep 16 '19 at 12:35