continuous-box2d

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

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
continuous-box2d
000.0.09 years ago9 years agoMinified + gzip package size for continuous-box2d in KB

Readme

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.