Skip to content

Demos ​

The demos are complete scenes to keep running beside your other VR apps. Each combines several engine features; the example scripts show one feature at a time.

tools/install-user-service.sh copies the demos into the script catalog as demos/, so the dashboard's Library lists them as demos/clock.js and so on; rerun it after pulling changes. See SteamVR dashboard. The installed demos load their models and fonts from the checkout, where the engine service runs. To run one directly from the repository root instead:

sh
./run-pocketspace.sh --scripts-dir demos --launch clock.js

Saves follow the script's catalog path, so a demo run from demos/ this way keeps its saves apart from the installed demos/clock.js.

Demos show a controller's laser only while it points at something you can press or grab. What a demo saves stays in its own save namespace; clear it with the dashboard's Reset or pocketspace-cli data reset <name>.

Desk clock and timer ​

clock.js shows the time and date above a countdown timer.

ControlAction
Trigger on 1, 5, 15 or 25Set the timer to that many minutes and stop it.
Trigger on Start / PauseRun or pause the countdown. A timer at zero starts again from its duration.
Trigger on ResetStop the timer and return it to its duration.
Trigger on 24h / 12hSwitch the clock between 24-hour and 12-hour time.
Trigger or grip on the blue handleMove the clock. It stands on the handle and turns to face you.

At zero the panel flashes and both controllers buzz once a second for ten seconds. A press on the panel during the alarm silences it without pressing the button underneath.

Saved: the clock's position, the last duration and the clock format. A running countdown is not saved.

Shows: retained-canvas drawing that redraws only when the display changes, panel buttons with hover, haptics, a panel following a grabbed object, and saved data.

Performance monitor ​

monitor.js is a compact panel with the engine's frame rate, CPU use, resident RAM, driver-reported GPU memory and its GPU allocation estimate, from getEngineStats. Each has its current value and a line of the last 60 samples. Statistics are sampled about once a second, and the panel redraws only when a new sample arrives.

ControlAction
Trigger or grip on the blue handleMove the monitor. It stands on the handle and turns to face you.

FPS is drawn from zero to at least 90 and CPU from zero to at least 100%. Memory lines span their own minimum and maximum, so small changes stay visible. A value the system does not report, such as GPU memory without DRM fdinfo, shows n/a and leaves a gap in its line. The statistics cover the whole engine, not only this demo.

Saved: the monitor's position.

Shows: engine statistics, a retained canvas redrawn once per sample, a panel following a grabbed object, and saved data.

Sketch board ​

sketch.js is a 0.8-meter whiteboard in front of you with a toolbar along its top.

ControlAction
Hold the trigger on the boardDraw. Each hand draws its own stroke, so both can draw at once.
Trigger on a colour swatchPick one of six colours.
Trigger on a brush dotPick a small, medium or large brush.
Trigger on UndoRemove the last stroke, or bring back what the last Clear removed.
Trigger on ClearEmpty the board.

The drawing is saved after every stroke and when Undo or Clear changes it, so it is back on the next start, and Undo still works on it. Strokes are stored as points in the demo's saved data, whose 64 KiB limit holds several thousand points. A stroke that reaches the limit ends there, Undo and Clear turn red, and the board accepts no new strokes until one of them makes room. Undo can bring back what a Clear removed only until the demo stops.

Saved: the strokes on the board. The chosen colour and brush are not saved.

Shows: panel hover and pointer events with pixel coordinates, two hands on one panel, canvas circles and rectangles on a retained canvas, partial redraws of the toolbar, and saved data.

Sticky notes ​

notes.js hands out coloured notes to leave around you. Each note hangs from a small yellow pin, and the dispenser stands on a blue handle.

ControlAction
Trigger on a colour on the dispenserTake a note of that colour; it appears above the dispenser.
Trigger or grip on a note's pinMove the note. Notes turn to face you.
Trigger on a noteCycle its label: To do, Done, Idea, Call, then the note's own number.
Drop a note's pin on the red binRemove the note.
Trigger or grip on the blue handle or the binMove the dispenser or the bin.

Up to 32 notes can be out at once, the most one scene save holds; the dispenser then asks you to bin some. Notes are numbered in the order they are taken, and numbers are not reused.

Saved: the notes, with their positions, colours and labels, after every change; the dispenser and bin positions; and the next note number. The notes are a scene save of their own container, restored with fresh IDs; their labels, colours and numbers are saved data that the demo maps onto the restored notes.

Shows: scene containers, spawning and removing objects and panels, grabbing, panels following objects, scene saves with ID remapping, shared render groups for the pins, and saved data.

Basketball toss ​

basketball.js puts a mini arcade hoop 2.5 meters in front of you, with its rim 1.6 meters above your floor, a shelf of three balls at your right hand and a scoreboard above the backboard.

ControlAction
Trigger or grip on a ballPick it up. Throw it by letting go while your hand moves.
A or XReturn every ball you are not holding to the shelf.

A ball released at more than 1 m/s counts as a shot. It scores when it drops down through the rim, and the hand that threw it buzzes. The scoreboard shows Swish! for a clean basket, Basket! after touching the rim and Bank shot! off the backboard. A shot that lands on the floor first, or a ball picked up again before it scores, ends the streak. Balls that fall below the floor or roll more than 6 meters away come back to the shelf.

The floor is invisible and sits where SteamVR tracks yours, from getFloorHeight; without it, the demo assumes 1.4 meters below the scene origin.

Saved: the best streak. Baskets and shots count from zero each time.

Shows: dynamic bodies and throwing, a static mesh collider for the rim and post, restitution and friction, collision events for rim, backboard and floor contacts, haptics, the tracked floor height, a shared render group for the hoop, and saved data.

Desk toys ​

desk-toys.js puts a wooden desk at desk height in front of you, from getFloorHeight, with a Newton's cradle on the left and a green spinner on the right.

ControlAction
Trigger or grip on a cradle ballHold it. Pull an end ball out and let go to set the cradle going.
Trigger or grip on the spinnerTurn it by hand; let go while moving to flick it.
A or XSwitch the spinner's motor on or off.
BumperReset the cradle and the spinner, and switch the motor off, when you are not holding either.

Each ball hangs on a hinge through the pivot between its two strings, so it swings only along the rails. A rigid-body solver shares an impact across the whole touching row, so the demo hands it on as a real cradle does: when one or more swinging balls strike the row, the row stops and as many balls swing out of the far end at the striking speed. Balls held in your hand pause the hand-off. The motor drives the spinner at 10 radians per second; switched off, it coasts to a stop.

Saved: nothing.

Shows: hinge joints with limits, a hinge motor, collision events, setting velocities, grabbing jointed bodies and the tracked floor height.

Pet fox ​

pet-fox.js lets the animated Fox sample roam a circle of floor 2.6 meters across in front of you, on the floor SteamVR tracks.

ControlAction
Look at a spot on the floorAfter you hold your gaze there for 0.4 seconds, the fox heads to it.
Trigger or grip on the foxPick it up. Let go to put it down; it drops to the floor.

The fox runs to targets more than a meter away and walks to nearer ones, blending between its clips, turns toward where it is going, and plays its idle survey when it arrives. Without eye tracking, or while you look elsewhere, it picks its own spots every few seconds. Gaze outside the circle, or above the horizon, is ignored. A fox put down outside the circle lands at its edge.

Saved: nothing.

Shows: skeletal animation with blended transitions, gaze tracking, grabbing an animated model, scripted movement and facing, and the tracked floor height.

Lighting studio ​

lighting-studio.js shows physically based materials on a slowly turning turntable: the toy car, the lantern, gold and plastic spheres of rising roughness, and the fabric sheen sample. They are lit by the baked studio environment, a yellow lamp and a blue sun paddle. A small panel on your left switches the studio's features.

ControlAction
Trigger or grip on the yellow lampMove it; it carries a shadow-casting point light just below the bulb.
Trigger or grip on the blue paddleMove and turn it; the sunlight shines out of its underside.
Trigger on EnvironmentSwitch the studio environment's light and reflections on or off.
Trigger on ShadowsSwitch the lamp's shadows on or off.
Trigger on TurntableStart or stop the turntable.

The turntable turns once every 25 seconds. Each piece's own directional light is off, so all light comes from the environment, the lamp, the sun and a little ambient light. Shadows render six views each frame; the car accounts for most of their triangles.

Saved: nothing.

Shows: PBR materials including metal, plastic, glass and fabric sheen, environment lighting, point and directional lights attached to objects, point-light shadows, scripted turntable motion and panel buttons.

Released under the GNU AGPL v3.0 only.