Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

box2d-native

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

box2d-native

Box2D as native addon

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 04 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc