Box2d+
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.
3. Stress test. A comparison with Chipmunk (which, from my previous testing, is the best non-emscripten physics library in JavaScript) and the standard asm.js physics behavior. The test creates a pyramid of boxes that you can interact with or just watch collapse....
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 (v1.0.1.8): 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
Speed clamp
Rotational speed clamp
Collision point
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)
Gravity attractor
Polygon editor capx (demo: link)
Platformer behavior capx. Demo (with one-way doors/floors and wall-climb): link
Instructions!
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).
Friction joint.
Rope joint. The box2d rope joint stretches and breaks far too easily to be useful. Work-around: use revolute joints.
*latest changes