May 2018
Intermediate to advanced
470 pages
13h 54m
English
In order to register the click behavior on each 3D object added to the game, we need to wrap the Entity component with a VrButton component that can call the onClick handler.
We will update the Entity component added inside the vrObjects array iteration code, to wrap it with the VrButton component. The VrButton will call the collectItem method when clicked, and pass it the current object's details.
/MERNVR/index.js:
<VrButton onClick={this.collectItem(vrObject)} key={i}> <Entity … /></VrButton>
When a 3D object is clicked, the collectItem method needs to perform the following actions with respect to the game features:
Read now
Unlock full access