new Box2dPlugin(instance)box2d.js:2280Create the global Box2D plugin object, box2dInit does this
instanceObject
Box2D Global Object
new Box2dPlugin(instance)box2d.js:2280Create the global Box2D plugin object, box2dInit does this
instance ObjectbodyTypeDynamic : numberbox2d.js:2309Dynamic, positive mass, non-zero velocity determined by forces, moved by solver
bodyTypeKinematic : numberbox2d.js:2306Kinematic, zero mass, non-zero velocity set by user, moved by solver
bodyTypeStatic : numberbox2d.js:2303Static, zero mass, zero velocity, may be manually moved
instance : Objectbox2d.js:2290The Box2d instance
objects : Array<Box2dObject>box2d.js:2296List of all Box2d objects, a destroyed one stays until the next step with its body undefined
positionIterations : numberbox2d.js:2300Position iterations per update
velocityIterations : numberbox2d.js:2298Velocity iterations per update
world : Objectbox2d.js:2292The Box2d world
boxCast(pos, size, includeSensors) → Box2dObject|undefinedbox2d.js:2501The 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:2470Every 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) → Objectbox2d.js:2697casts a box2d object to a joint type
o ObjectcastShapeObject(o) → Objectbox2d.js:2677casts a box2d object to a shape type
o ObjectcircleCast(pos, diameter, includeSensors) → Box2dObject|undefinedbox2d.js:2548circle 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:2533circle 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:2609draws a fixture
pointCast(pos, dynamicOnly, includeSensors) → Box2dObject|undefinedbox2d.js:2568point 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:2459raycast and return the first result
raycastAll(start, end, includeSensors) → Array<Box2dRaycastResult>box2d.js:2423raycast and return a list of all the results, nearest first
vec2dTo(v) → Objectbox2d.js:2663converts 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