Skip to content

World player

World player example.

js
import { Player, registerAllComponents } from "@tmrw-realityos/world";

export async function ready() {
  // get the html canvas and start the player
  const canvas = document.querySelector("canvas");
  if (canvas == null) {
    return;
  }

  const player = new Player("https://tamat.room.xyz/assets/");

  //enforce loading all possible components
  registerAllComponents();

  //initialize the player
  await player.init(canvas);

  const data = await player.world.load("https://tamat.room.xyz/assets/rooms/branded/room_6p.json");
  player.camera.configure(data.scene.camera);

  // Note that this starts player's own requestAnimationFrame loop.
  player.start();
}