A free and open source LSL script for Second Life to help you build simple cube-based structures quickly and neatly. Released under the GNU GPL v3.


Get Stackable Graph Cubes free on SL Marketplace

About Stackable Graph Cubes

In response to a request on the SLOODLE forums, I decided to try making a script to let you reliably drag-move cubes around, such that they would ‘snap’ together, so you can build graphs and other blocky shapes. It was a good challenge, and so I’ve created a script to do the job.


If you got a ready-made cube from the SL Marketplace, then simply rez a few instances of it on the ground. Hold the Control key and click-and-drag the cubes around. When you let go, the cube should snap into alignment with the nearest other cube.

If you just download the script, then you’ll first need to create a cube in-world (size 0.5×0.5×0.5). Add the script in, and clone your new cube a few times (make sure each one has the same name). It’s also useful to make sure anybody can move the cubes, and that’s it. You’re ready to start playing with your new Stackable Graph Cubes.


1. Cubes will only snap to other cubes of the same name. You can use that to create independent stacks of cubes which won’t interfere with each other.

2. If you want to create an immovable base, then disable the script in one of your cubes (but do not delete the script… just clear the “Running” checkbox). Other cubes will snap to that base, but the base won’t snap to other ones. It’s a good idea to change its colour to signify the difference, and to disable drag-moving on it.

3. The size of the cubes is important. If you want to use a size other than the default (0.5×0.5×0.5) then you’ll need to modify the script.

Get the scripts

  • stackable_graph_cube_1.2.lsl — changed the event handling to respond to touches rather than moving (idea courtesy of Jeremy Kemp… ta!), and re-enabled physics by default, as it works better now. You can now also simply touch a cube to align it, in case lag is a problem
  • stackable_graph_cube_1.1.lsl — physics disabled by default, cubes snap in all dimensions, and rotations are (hopefully) fixed
  • stackable_graph_cube_1.0.lsl — allows (buggy) physics, works with vertical stacking only, and has rotation problems