0.0.8 • Published 9 years ago

box2d-native v0.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Build Status

box2d-native

Box2D v2.3.1 as native Node.js addon.

Details

Box2D compiled as static library, Node.js C++ addon produced by swig.

Install

Requires curl, make, cmake, g++. See also requirements for building swig and node-gyp

Install with NPM:

npm install node-gyp -g
npm install box2d-native

IMPORTANT: Installation tested only on Linux with Node.js >= 4.2.1 and gc++ 4.9.

Usage

import {World, Vec2, BodyDef, Body} from 'box2d-native';

let world = new World(gravity);
let body = world.CreateBody(new BodyDef());

world.Step(1 / 60, 3, 3);

Original "namespaced" Box2D classes (b2Vec2, b2World...) are also exposed.

Demo

IMPORTANT: Runs only with Node.js v4.2.1

npm install node-gyp -g
git checkout https://github.com/zuker/box2d-native.git
cd box2d-native/demo
npm install
npm start

Performance

Results from bench2d (i7 2.9GHZ, 4GB RAM, Ubuntu 15.04):

  • box2d.js: ms/frame: 3.5537109375 5th %ile: 3 95th %ile: 4

  • box2d-native: ms/frame: 1.689453125 5th %ile: 1 95th %ile: 2

TODO

  • Improve demo (implement all stuff from C++ Box2D testbed).
  • Refactor build, use more convenient tool.
  • Provide more benchmark results to compare with.
  • Tests.
0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago