Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Generate a bunch of box2d bodies to match a grid backed by ndarray-continuous
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
LICENSE.md
README.md
demo.js
index.html
index.js
package.json

README.md

continuous-box2d experimental

Generate a bunch of box2d bodies to match a grid backed by ndarray-continuous.

The demo still needs some tweaking/optimisation work but you can find it here. It also shares a lot of code with the topdown-physics demo.

Installation

npm install continuous-box2d

Usage

cb2d = require('continuous-box2d')(Box2D)

Pass Box2D to the module to get back a continuous-box2d.

cb2d(world, field[, options])

Generates and removes bodies to world as chunks are added/removed to the continuous ndarray field. Takes the following options:

  • data: A callback to modify the userData that gets attached to each body.
  • xscale: the horizontal scale of the grid, in cell units to box2d units. Defaults to 1.
  • yscale: the vertical scale of the grid. Defaults to 1.
Something went wrong with that request. Please try again.