Altspace game

Pinball

A playable pinball machine for SideQuest / AltspaceVR worlds: real ball physics, flippers, a plunger you pull back, pop bumpers, slingshots and drop targets, with sounds and lights. In VR and on PC.

Open pinball.firer.at as a space in Altspace to try it.

How to play

  • In VR: grab the sides of the cabinet and pull the triggers for the flippers. Grab the plunger, pull it back and let go to launch the ball.
  • On PC: stand on the glowing square on the floor in front of the machine. Left Shift and Right Shift work the flippers. Hold Enter and let go to launch: the longer you hold it, the harder the launch.
  • The keys only work while you stand on the square, so they don't get in the way anywhere else in the world.
  • You get 3 balls. A ball that gets past the flippers is lost; after the last one, launch again to start a new game.
  • Everyone plays their own game: the ball isn't synced, so two people can't play the same game.

1. Pick how you build your world

Pinball is an Altspace snippet: a ready-made piece you drop into your world. Its name (the "slug") is always:

Type it exactly like that (all lowercase). Pick the way you build your world and follow that section below.

Recommended

I build my world in Unity

You use the Altspace Creator SDK in Unity. You get the settings in the Inspector, and you can move the machine with the gizmo.

Go to the Unity steps
No Unity needed

I edit my world on the website

You edit your world on altvr.app in your browser. You copy the snippet from the Snippets section (or below) and paste it into your world's HTML.

Go to the website steps

2a. Add it in Unity

You need a Unity project with the Altspace Creator SDK already set up, and your world's scene open.

  1. Make an empty object. In the top menu choose GameObject › Create Empty. Rename it to Pinball so you can find it later (the object's name doesn't matter, only the slug does).
  2. Add the Snippet component. Click Add Component, type Snippet in the search box, and pick BS › Snippet.
  3. Type the slug and press Enter. In the Snippet's Slug box type and press Enter (the box only takes it after Enter or clicking somewhere else). It downloads the snippet and adds it to your world's Assets/WebRoot/index.html for you. After a moment the Inspector shows the title Pinball and its settings. If nothing happens, click Refresh from server.
  4. Put the machine where you want it. Set position to the spot on the floor (or drag the gizmo), and rotation to turn it, for example 0 180 0. Players stand on the machine's +Z side, so leave about 1.5 m of floor there.
  5. Save the scene. Press Ctrl + S (Windows / Linux) or Cmd + S (Mac). Do this every time you add or remove a snippet. Closing Unity without saving is the main way extra copies of the snippet end up in index.html.
  6. Upload your world the same way you always do, then join it in Altspace.

2b. Add it on the website

  1. Open your world for editing on altvr.app and go to the Snippets section.
  2. Find Pinball. Set the list to show All snippets, then search for Pinball (or scroll to it) and open it.
  3. Copy it. Click Copy & open index.html. This copies the snippet's code and opens your world's HTML (or copy the full snippet code below).
  4. Paste it in the right place. If your HTML has these two lines, paste between them:
    <!-- snippet section -->
       paste here
    <!-- end snippet section -->
    If it doesn't have them, paste it just before </body>.
  5. Change the settings by editing the values in quotes in the pasted code, for example position="4 0 -2".
  6. Save, then join your world.

Keep the code tidy. Every value needs quotes around it (position="4 0 -2", not position=4 0 -2), and a & in any link must be written as &amp;. Unity reads this part strictly, and one mistake can break the whole snippet section.

The full snippet code

This is everything the snippet adds, with every setting at its default. Click the code to copy it.

Full snippet code
<!-- snippet section -->
<bs-snippet name="pinball" title="Pinball"
  description="A playable pinball machine with real ball physics, sounds and lights. VR: grab the cabinet sides and pull the triggers. PC: stand on the square in front, Shift keys flip, hold and release Enter to launch."
  script="https://pinball.firer.at/snippet.js"
  position="0 0 0"
  rotation="0 0 0"
  bundle-base="">
  <bs-gizmo type="position" attribute="position"/>
</bs-snippet>
<!-- end snippet section -->

Settings

All optional. An empty or missing setting uses the default.

SettingDefaultWhat it does
position0 0 0Where the machine stands: x y z in world units (metres), the floor under the middle of the cabinet.
rotation0 0 0How it's turned: x y z in degrees, usually just the middle one (0 90 0). Players stand on its +Z side.
bundle-base(empty)A different folder to load the machine from. Leave it empty.

Good to know

  • You can add more than one machine: add the snippet again with a different position. On PC each machine only listens while you stand on its own square.
  • The square in front of the machine is 0.9 m across, so leave about 1.5 m of clear floor on the machine's +Z side.