Update client.js and mount to Location

The default code in client.js attaches the mount point declared in index.js to the Default Surface in the React 360 app, where the Surface is a cylindrical layer for placing 2D UI. In order to use the 3D meter-based coordinate system for a layout in 3D space, we need to mount to a Location instead of a Surface. So update client.js to replace the renderToSurface with a renderToLocation.

/MERNVR/client.js:

  r360.renderToLocation(    r360.createRoot('MERNVR', { /* initial props */ }),    r360.getDefaultLocation()  )
You can also customize the initial background scene by updating the code r360.compositor.setBackground(r360.getAssetURL('360_world.jpg')) in client.js to use your desired image.

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.