An unattended kiosk
Updated
A PDF noticeboard turns to the next page every eight seconds, and waits thirty seconds after a visitor turns a page with its pill.
Watch the pages turn every eight seconds, or use the page pill to read at your own pace. Drag elsewhere to orbit the camera, scroll to zoom.
An unattended kiosk
#pragma lifecycle(startup)
const PAGE_MS = 8000;const IDLE_MS = 30000;
let board;let pages = 1;let expected = 1;let cancelNext = () => {};
function schedule(ms) { cancelNext(); cancelNext = delay(() => { expected = board.props.page < pages ? board.props.page + 1 : 1; board.setProps({ page: expected }); schedule(PAGE_MS); }, ms);}
function startup() { board = self.parent.getComponent(PDFComponent);
on('kiosk', (event) => { if (event.eventType === EventType.PDF.Ready) { pages = event.data.pages; if (pages > 1) schedule(PAGE_MS); } if (event.eventType === EventType.PDF.Page && event.data.page !== expected) { // Someone used the pill: leave them time to read. expected = event.data.page; schedule(IDLE_MS); } });}How it works
Section titled “How it works”The script is explained step by step in An unattended kiosk.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
PdfKiosk.xrproj