Lucy b2
Box2D by Erin Catto with google's particle simulation liquidfun for node.js.
This fork
Fork from box2d.js.
Due to the fact that we are not creating sub-classes of C++ classes, we do not need to use 'b2' prefix to separate namespaces so this prefix has been removed.
// Instead of writing box2d.b2Vec2// Write this:const b2 = let gravity = 0 -98 let world = gravity // ...let shape =
Documentation
Example
Here is a falling ball simulation.
'use strict'const b2 = // Create worldlet gravity = 0 -98 let world = gravity // Define bodylet bodyDef = bodyDeftype = b2BodyTypedynamicBody // Create body with definitionlet body = world // Define fixturelet fixDef = fixDefdensity = 10fixDeffriction = 02fixDefrestitution = 08 let shape = shape fixDefshape = shape // Create fixturebody // Move body into initial position ( and rotation )body // Run simulationfor let i = 0; i < 10; i++ world console
Installation
npm install lucy-b2 --save
Tests
npm test
Contributing
Please see box2d.js for contributions. The port from this library is just a few Regexp executed on the minified JS version and a wrapper for node.js.
Please use 'jessy style' if you want to write some unit tests for lucy-b2...
Release History
- 1.0.1 (2015-09-22) Fixed readme.
- 1.0.0 (2015-09-09) Initial release.