ofxBox3D is an openFrameworks addon that provides a wrapper for the Box3D physics engine to facilitate 3D simulations.
README
ofxBox3D
openFrameworks addon wrapper for Erin Catto's Box3D.
This addon keeps Box3D as a git submodule at
libs/box3d and builds the Box3D core C sources through addon_config.mk. The wrapper in src/ is intentionally thin: use ofxBox3DWorld and ofxBox3DBody for common openFrameworks workflows, or include ofxBox3D.h and call the raw box3d/box3d.h C API directly.Layout
ofxBox3D/
addon_config.mk
libs/box3d/ # upstream Box3D submodule
src/ # openFrameworks wrapperMinimal Usage
#include "ofxBox3D.h"
ofxBox3DWorld world;
std::vector<ofxBox3DBody> boxes;
void ofApp::setup()
{
world.setup(glm::vec3(0.0f, -10.0f, 0.0f));
boxes.push_back(world.createBox({0.0f, 4.0f, 0.0f}, {0.5f, 0.5f, 0.5f}));
}
void ofApp::update()
{
world.update();
}
void ofApp::draw()
{
for (auto& box : boxes)
{
box.draw();
}
}ofxBox3DBody owns its Box3D body and is move-only. Store bodies by value in a vector, or use std::unique_ptr if stable addresses are useful for your app.Dependency
Box3D is MIT licensed. After cloning a project that uses this addon, initialize nested submodules:
git submodule update --init --recursive
ofxAddons