Box2D SimpleTestbed. UPDATE: Version 1.0
Posted: Mon Jun 18, 2012 10:43 pm
This is the project I've started working on.
Box2D on C++ has a great Testbed application, where you can quite easily add new physics environments to test out.
You don't need to use placeholder graphics or anything, because the Testbed renders the bodies, shapes, joints etc.
You can download it here: http://box2d.googlecode.com/files/Testbed_v2.1.3.zip [windows executable]
The main goal is to be able to test Lua/LÖVE based Box2D code, not just C++.
The original has a lot of features, and I probably won't port all of those.
My first aim is to get the rendering right with LÖVE's graphics tools and to be able to switch between simulations.
I hope this will be useful for everyone who's struggling with testing box2D's features.
Edit:
first prototype is ready. No camera yet. Thanks for Boolsheet on the IRC channel for the debugging
Edit:
version 0.2
added:
working GUI (except for the time step button and update frequency slider)
camera controls: arrow keys, keypad + - buttons for zooming. Mouse: wheels zoom, right button drags the screen. You can redefine any of the keyboard controls in your own test!
more advanced drawing: now correctly draws all the shapes. Bounding box drawing was added. Joint drawing was added. Coordinate system toggleable
edit:
version 0.21 bugfixes. Fixed Jansen walker, and I fixed the other tests too. Fixed drawing of angled shapes.
edit:
version 1.0 Added features: better drawing algorithm, mousejoint to manipulate objects, Time Stepping capabilities.
Controls:
arrow keys: they move the camera around
right click drag: moves the environment around
numpad +, numpad -, mousewheels: zooming
left click on shape, drag: it creates a mousejoint between a dynamic body and the cursor's position. It applies a force to the body.
How to add your own tests:
inherit a class from my Test class and save it in a lua file. The name of the class and the filename must match. Put your lua file in the tests directory. Tadaaa!
For more details check out the source of the default tests. Especially: tests/spherestack.lua
Box2D on C++ has a great Testbed application, where you can quite easily add new physics environments to test out.
You don't need to use placeholder graphics or anything, because the Testbed renders the bodies, shapes, joints etc.
You can download it here: http://box2d.googlecode.com/files/Testbed_v2.1.3.zip [windows executable]
The main goal is to be able to test Lua/LÖVE based Box2D code, not just C++.
The original has a lot of features, and I probably won't port all of those.
My first aim is to get the rendering right with LÖVE's graphics tools and to be able to switch between simulations.
I hope this will be useful for everyone who's struggling with testing box2D's features.
Edit:
first prototype is ready. No camera yet. Thanks for Boolsheet on the IRC channel for the debugging
Edit:
version 0.2
added:
working GUI (except for the time step button and update frequency slider)
camera controls: arrow keys, keypad + - buttons for zooming. Mouse: wheels zoom, right button drags the screen. You can redefine any of the keyboard controls in your own test!
more advanced drawing: now correctly draws all the shapes. Bounding box drawing was added. Joint drawing was added. Coordinate system toggleable
edit:
version 0.21 bugfixes. Fixed Jansen walker, and I fixed the other tests too. Fixed drawing of angled shapes.
edit:
version 1.0 Added features: better drawing algorithm, mousejoint to manipulate objects, Time Stepping capabilities.
Controls:
arrow keys: they move the camera around
right click drag: moves the environment around
numpad +, numpad -, mousewheels: zooming
left click on shape, drag: it creates a mousejoint between a dynamic body and the cursor's position. It applies a force to the body.
How to add your own tests:
inherit a class from my Test class and save it in a lua file. The name of the class and the filename must match. Put your lua file in the tests directory. Tadaaa!
For more details check out the source of the default tests. Especially: tests/spherestack.lua