Skip to content

PlayCanvas Compiler

Compiles HoloScript to PlayCanvas — the cloud-hosted WebGL game engine used for interactive 3D web applications.

Overview

The PlayCanvas compiler (--target playcanvas) generates a PlayCanvas project — entities, scripts, and assets — from a .holo or .hsplus source file. PlayCanvas scenes run directly in the browser with no plugin required, making it ideal for embedded 3D experiences, product configurators, and browser-based simulations.

bash
holoscript compile scene.holo --target playcanvas --output ./playcanvas-project/

Output Structure

playcanvas-project/
  __settings__.js       # Project settings
  __start__.js          # Entry point
  scripts/
    HoloScript_*.js     # Per-object script components
  assets/
    materials/
    textures/
  scene.json            # PlayCanvas scene JSON

Trait Mapping

HoloScript TraitPlayCanvas Component
@physicspc.RigidBodyComponent
@collidablepc.CollisionComponent
@animatedpc.AnimComponent
@networkedCustom sync script
@grabbableDrag script
@glowingEmissive material + bloom
@billboardpc.BillboardComponent

Example

holo
composition "ProductViewer" {
  environment {
    skybox: "studio"
    ambient_light: 0.6
  }

  object "Product" {
    geometry: "model/shoe.glb"
    @collidable
    @animated

    onHoverEnter { color = "#ff6600" }
    onHoverExit  { color = "#ffffff" }
  }
}

Compiles to a PlayCanvas scene with a drag-to-rotate 3D model viewer in under 30 lines of generated script.

Compiler Options

OptionDefaultDescription
--pc-versionlatestPlayCanvas engine version
--pc-hostedfalseEmit hosted CDN script tags instead of local
--pc-typescriptfalseEmit TypeScript scripts
--pc-physicsammoPhysics engine: ammo or cannon

See Also

Released under the MIT License.