Option 2: Standalone Plugin
This document provides a guide for using the Standalone Plugin to integrate Polygon Streaming into a PlayCanvas project or for creating VIVERSE standalone apps.
PlayCanvas Standalone Plugin
The standalone plugin can be used to publish projects in the PlayCanvas editor or to publish standalone apps on the VIVERSE platform. To do the latter you need to download the project and then upload it to VIVERSE Studio. See Downloading your Project on what steps you need to take to get this to work.
Install the plugin
Download the latest version of the PlayCanvas standalone plugin here. Import the polygon-streaming.js and ps-service-worker.js scripts into the Assets window of the PlayCanvas project.

Create the StreamController
A. Create a new entity and name it StreamController. This entity will control the streaming models inside the project.
B. Add a script component to the entity and then add the StreamController script to the script component. You can check detailed information on these parameters here.
C. Add the Camera entity from the project to the Camera field.

Create the StreamableModel
A. Create a new entity and name it StreamableModel.
B. Add a script component to the entity and then add the StreamableModel script to the script component. This will create the component to stream the model inside the scene.
C. Paste the URL address of your streaming model into the Path or url to model field. In the Polygon Streaming console you can get the URL of a model by clicking on the 3 dots on the top right hand corner of the model thumbnail and selecting Copy asset ID from the drop down menu.

Downloading your project
The downloaded project zip file can be uploaded to VIVERSE Studio to publish on the VIVERSE platform as a standalone app or you can host the unzipped project files yourself.
A. Click on the Publish/Download button on the left.
B. Press the Download button in the top right of the Builds dialog.
C. In the Download New Build dialog uncheck Concatenate Scripts.
D. Press the Download button
E. Once PlayCanvas has built your project press the download button (downward arrow) on the right-hand side of the build.
G. If you are hosting the files yourself you need to copy ps-service-worker.js from the plugin into the root of the unzipped project.

Component Attributes
See here for a description of the attributes used in the Stream Controller and Streamable Model components.
Last updated
Was this helpful?

