new Box2dPlugin(instance)box2d.js:2422Create the global Box2D plugin object, box2dInit does this
instanceBox2dModule
Box2D Global Object
new Box2dPlugin(instance)box2d.js:2422Create the global Box2D plugin object, box2dInit does this
instance Box2dModulebodyTypeDynamic : numberbox2d.js:2453Dynamic, positive mass, non-zero velocity determined by forces, moved by solver
bodyTypeKinematic : numberbox2d.js:2450Kinematic, zero mass, non-zero velocity set by user, moved by solver
bodyTypeStatic : numberbox2d.js:2447Static, zero mass, zero velocity, may be manually moved
instance : Box2dModulebox2d.js:2433The Box2d instance
objects : Array<Box2dObject>box2d.js:2440List of all Box2d objects, a destroyed one stays until the next step with its body undefined
positionIterations : numberbox2d.js:2444Position iterations per update
velocityIterations : numberbox2d.js:2442Velocity iterations per update
world : b2Worldbox2d.js:2436The Box2d world
boxCast(pos, size, includeSensors) → Box2dObject|undefinedbox2d.js:2664The first object whose shapes' bounding boxes overlap a box, not the shapes themselves, so near the corner of a turned box or a circle it finds one the box does not touch; use pointCast or a raycast for exact
boxCastAll(pos, size, includeSensors) → Array<Box2dObject>box2d.js:2633Every object whose shapes' bounding boxes overlap a box, not the shapes themselves, so near the corner of a turned box or a circle it finds one the box does not touch; use pointCast or a raycast for exact
castJointObject(o) → b2Jointbox2d.js:2860casts a box2d object to a joint type
o b2JointcastShapeObject(o) → b2Shapebox2d.js:2840casts a box2d object to a shape type
o b2ShapecircleCast(pos, diameter, includeSensors) → Box2dObject|undefinedbox2d.js:2711circle cast and return the object whose position is nearest, of those within the circle
pos Vector2diameter numberincludeSensors boolean optional, default falseAlso find objects whose shapes are all sensors, like trigger zones
circleCastAll(pos, diameter, includeSensors) → Array<Box2dObject>box2d.js:2696circle cast and return all the objects whose position is within the circle, wherever their shapes are
pos Vector2diameter numberincludeSensors boolean optional, default falseAlso find objects whose shapes are all sensors, like trigger zones
drawFixture(fixture, pos, angle, color, lineColor, lineWidth, useWebGL, context)box2d.js:2772draws a fixture
pointCast(pos, dynamicOnly, includeSensors) → Box2dObject|undefinedbox2d.js:2731point cast and return the first object
pos Vector2dynamicOnly boolean optional, default trueincludeSensors boolean optional, default falseAlso find sensors, so a pickup radius does not grab its object from afar
raycast(start, end, includeSensors) → Box2dRaycastResult|undefinedbox2d.js:2622raycast and return the first result
raycastAll(start, end, includeSensors) → Array<Box2dRaycastResult>box2d.js:2586raycast and return a list of all the results, nearest first
vec2dTo(v) → b2Vec2box2d.js:2826converts a Vector2 to a new box2d vec2, which stays until destroyed with box2d.instance.destroy; the plugin itself passes Box2D reused ones, since Box2D copies every vector it is given
v Vector2