Box2D editor - R.U.B.E. free


Intro


Update: This version of the editor is no longer maintained. It has been superceded by the new version, available here. The new version is not free, but it's well worth the price :)

(Original page creation date August 2011)
I am working on a graphical editor which can edit a Box2D world, and fits into the standard Box2D testbed so that any of the existing tests can be edited on the fly. Switching between the editor and the normal testbed is done by switching the GLUT functions and changing the GLUI panel. As well as editing the current world running in the test, the editor can load and save JSON files using b2djson. The working title for the editor is R.U.B.E., standing for Really Useful Box2D Editor.

The editor is not yet ready for release but it has become Really Useful already - the Box2D scene for Lotto mixer was created in a few hours with RUBE. I've uploaded some youtube videos showing screenlapses of sessions creating other scenes, and some binaries below if anyone is interested in playing with the current 'bleeding edge' build (bugs included :)). The editor has some basic on-screen help built in, but I know this is not enough to really learn how to use the editor. The controls are inspired by Blender, so if you are a Blender user you will feel right at home, otherwise quite frankly, you won't. I will make some video tutorials later to explain properly how to use the program, but at this point in time I have spent so damn long making the thing I just wanted to put it out there for some feedback.

Box2D editor R.U.B.E.

Current features

  • background grid to easily judge sizes
  • mouse over to view attributes of bodies/fixtures/joints/vertices
  • measure distances
  • select bodies/fixtures/joints/vertices (multiple select supported)
  • set attributes of bodies/fixtures/joints
  • translate and rotate bodies
  • translate, rotate and scale fixtures
  • translate, rotate and scale vertices
  • vertex positions which would create invalid windings are checked in real-time while moving
  • rotate and scale can be around cursor position or selection center
  • delete bodies/fixtures/joints/vertices
  • copy and paste bodies
  • copy and paste fixtures between bodies
  • add new bodies to the world
  • add new fixtures to a body
  • add new vertices to polygon, edge and chain shapes
  • add joints (revolute, distance, prismatic, wheel, rope)
  • set joint anchor positions
  • set joint limits
  • set names for objects to be saved in JSON data
  • save and load JSON file
  • show an image in the background to 'trace' over
  • duplicate a mirrored set of bodies and joints
Here is a video showing some of these features:



Future plans


In the future I would like to move this into a more capable GUI, probably Qt. GLUI is ok for quick prototyping, but has too many limitations for the kind of tool that this editor is becoming.

Update 2012 Jan 6: Work has begun on the pro version of R.U.B.E.
Update 2012 Dec 3: The pro version of R.U.B.E is now available.


Video demos


Here are a couple of videos showing screenlapses of creating a scene with the editor. At the end of each video the finished scene is shown playing in real time.

1. Creating a Rube Goldberg contraption. Uses revolute, prismatic and distance joints. Total creation time was about 2.5 hours.



2. Creating a simple car. Uses wheel joints, a background image as reference, then gets the named wheel joint in the program code to control the motor speed. Total creation time including some coding and tweaking of the 'camera' position to follow the car was just over 1 hour.



* If anyone knows of a utility like XVidCap that doesn't crash every ten seconds, tell me! aha, recordmydesktop ftw!



The vehicle examples in the b2djson JSON loader demo were made with this editor too (well, except for one of them :))
View YouTube video Box2D vehicles


The R.U.B.E editor was used to create the scene in this game made for the December 2011 'Ludum Dare', a 48 hour game creation competition.
Sourcecode and binaries available here
Alone in the park LD22 screenshot Alone in the park LD22 screenshot Alone in the park LD22 screenshot



Binaries


You can download a binary build of the editor below. For now you'll have to get by with the built-in help, and the notes below.

R.U.B.E. Windows binary (Filetime: July 14 2013)

R.U.B.E. Linux binary (Filetime: July 14 2013)

R.U.B.E. Mac OSX binary (Filetime: January 08 2012)

This binary includes the Rube Goldberg scene in the video above, but it might not run through correctly for you since it's quite sensitive to determinism issues.

For the brave early birds...

Update 2011/11/27: Selected bodies can now be mirrored, along with any attached revolute joints (Shift-M). Details here.

Update 2012/01/07: Fixed some bugs that caused a crash when adding or deleting vertices in chain shapes. This usually showed up when working with very long chains.

- press Ctrl+E to switch between editor and normal testbed
- read the built-in help!!!! (press H and look in top left)
- read the context help!!!! (different help is shown while translating, rotating etc)
- press Ctrl+L to load a file, Ctrl+S to save
- use Shift to add to the current selection, Ctrl to toggle selection
- to add a body, press the Create body button while in body mode
- to add a fixture, first select a single body, select the shape type and press the Create fixture button
- to add a joint, first select two bodies, select the joint type and press the Create joint button
     The first body selected will become bodyA of the joint
- all additions (body/fixture/joint) will be placed at the cursor position (the red and white circle marker)
- the Apply settings buttons will apply to all selected objects, be careful
- press Ctrl+C to copy, Ctrl+V to paste
- joint limits are set by selecting the joint and bodyB, the moving/rotating bodyB to the desired location.
     Read the context help for details - this method is kinda awkward and I might rework it later
- if the file 'rubetrace.bmp' exists it will be loaded as the tracing image. Use +/- to resize it
- currently the editor is modal - when you Ctrl+E to switch back to the normal testbed, all editor state is lost.
     You will need to save before leaving the editor, and load after returning to the editor
     if you want to preserve the exact state you had before, with named objects etc.
- if a bitmap image named 'rubetrace.bmp' exists in the same folder as the application, it will be loaded and display at (0,0) and can be scaled with the +/- keys
- the selected bodies can be mirrored horizontally about the cursor with Shift-M

Known issues:
- setting the mass of a body is not working and may be altered later, please ignore it
- setting the density of a fixture will not cause the mass to be updated until the next load.
     You can get around this by adding or pasting a fixture into the body
     to force a reset of the mass data, then deleting the fixture afterwards
- occasional crash when moving fixtures - save regularly :)