This is an ongoing project to port the emscripten/asm.js version of Box2d v2.3.0 to Construct 2. The performance is amazing - more stable than Chipmunk and much more stable than the standard asm.js physics. Plus there are some useful game-dev friendly features. It is easy for a beginner to use but powerful enough to keep the more experienced happy. At least, that's the plan. Of note, it doesn't play nicely with the standard physics plugin and will cause your browser to vanish into a singularity if both are used in the same project (the emscripten libraries interfere at runtime).
There main demo has 4 parts:
1. The start screen gives you an idea of performance and demonstrates one-event conveyor belts with kinematic bodies. Collision points and polygons can be selected to be drawn and objects can be thrown around.
2. Bitmap / scan image. This is a demo with 2 objects - one fixed and one that will be re-spawned; when running, both types can be dragged. You can use the default images or upload your own into the demo. When you press Start the engine will scan the images and assign collision polygons from the image alpha.
4. Draw objects. Draw some physics shapes, convex or concave, and watch them fall down. The shape vertices are stored in a c2 array which is loaded into the Box2D+ plugin to form the collision polygon.
Here's the demo (v220.127.116.11): link
Summary of features:
Plugin features already completed:
Scan image to create polygon from its alpha (uses adjusted versions of hull.js and simplify.js)
Circle, polygon and box shapes
Rotational speed clamp
Dynamic, Static and Kinematic bodies
Collision filtering (category and mask bits)
Object gravity scale
World x and y gravity values
Load collision hull from c2 json array
Get collision hull as c2 json array (create polygons outside your game and upload from string)
Raycast world queries
Assimilate Joint - demo: link
All joints are demo'd here: link
AABB world queries (find objects in a defined box area)
Polygon editor capx (demo: link)
Platformer behavior capx. Demo (with one-way doors/floors and wall-climb): link
More joint helper expressions added
Obtain collision impulse and collision impulse angle*
Obtain pre-collision and post-collision velocity (x and y values)*
Collision Pre-Solve trigger and an action to disable the collision.*
Features to do:
A platform behavior helper plugin, so you won't need to mess with complicated events to control the movement and doors etc.
The test is just about finished....!
Ideas and suggestions are welcome.
Not included / what's been excluded:
Mouse joint (no need, better done using events and hidden object).
Rope joint. The box2d rope joint stretches and breaks far too easily to be useful. Work-around: use revolute joints.