Skip to content
xeolabs edited this page Sep 28, 2012 · 2 revisions

The grid shell is a JavaScript interpreter built into the grid's index page, through which you can talk directly with the grid.

Like the Quake terminal, you can pop it open with the tilde key (~).

The terminal will have the grid object in its global namespace. In the terminal you can therefore do all the stuff a grid script would do.

Try this

  1. Start the grid with no boot script selected - right-click this link to open the grid in a new window
  2. Type '`' - that's a "tilde" character.
  3. See the JavaScript terminal appear?
  4. Drop some grid script into the terminal:
grid.send({
    action: "module.load",
    modules: ["scenes/scene"],
    configs: {
        canvasId: "theCanvas"
    }
},
    function() {
      grid.send({
          action: "module.load",
          modules: [
              "camera/camera",
              "objects/prims/teapot"
          ]
      },
      function() {
         grid.send({
             action:"camera.set",
             eye : { x: 0.0, y: 10.0, z: 10 },
             look : { y:1.0 },
             up : { y: 1.0 }
         });
      }); 
})

You should see a blue teapot (if not, then this example is out date for the latest API, drop me a line!).

Try dropping in all the simple example scripts.

Note:

  • You'll need to reload the page before you drop in each example because otherwise you'll get errors reporting clashes between IDs of things, modules already loaded, and so on.
  • We're serving the grid straight off GitHub though a page rendering proxy - it seems to timeout on some of the larger assets the first time you load them - reloading seems to fix things. Perhaps the proxy need a chance to cache things.
Clone this wiki locally