Option 3: HTML Scripting
This document provides a guide for using HTML Scripting to integrate Polygon Streaming into a PlayCanvas project that does not target publication to VIVERSE.
PlayCanvas Direct HTML Plugin
1
2
3
Define an Entity
// add a Polygon Streaming controller
const streamController = new pc.Entity();
streamController.addComponent("script");
streamController.script.create("streamController", {
attributes: {
camera: camera,
cameraType: "nonPlayer",
occlusionCulling: true,
occlusionGeometry: "boundingBox",
occlusionQueryFrequency: 8,
triangleBudget: 3000000
mobileTriangleBudget: 1000000,
minimumDistance: 0.01,
distanceFactor: 1.1,
distanceType: "boundingBoxCenter",
maximumQuality: 15000,
closeUpDistance: 3,
closeUpDistanceFactor: 5,
iosMemoryLimit: 0
}
});
// add a Polygon Streaming model
let streamableModel = new pc.Entity();
streamableModel.addComponent("script");
streamableModel.script.create("streamableModel", {
attributes: {
path: "/model.xrg",
qualityPriority: 1,
useAlpha: true,
castShadows: true,
receiveShadows: true,
doubleSidedMaterials: false,
initialTrianglePercent: 0.1
playAnimationAutomatically: true,
animation: 0
}
});
// add model to stream controller
streamController.addChild(streamableModel);
// add stream controller to the scene
app.root.addChild(streamController);Last updated
Was this helpful?