continuous-box2d

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

npm install continuous-box2d
2 downloads in the last week
4 downloads in the last month

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.
npm loves you