April 2020
Intermediate to advanced
716 pages
18h 55m
English
We will add 3D objects to the game world using Entity components from React 360, along with the sample object details in the answerObjects and wrongObjects arrays that were defined for the game.
First, we will concatenate the answerObjects and wrongObjects arrays in componentDidMount to form a single array containing all of the VR objects, as shown in the following code:
/MERNVR/index.js
componentDidMount = () => { let vrObjects = this.state.game.answerObjects.concat(this.state.game.wrongObjects) this.setState({vrObjects: vrObjects}) ...}
This will give us a single array containing all of the VR objects for the game. Then, in the main view, we will iterate over this merged vrObjects array to render the Entity components ...
Read now
Unlock full access