Repository navigation
v3.6
3.5 was published on GitHub; this section is everything after it.
- Blocks with holes (any outline, holes of any shape at any position):
createShapeWithHoles,registerHoles, the wood blocksWoodBlock16(a square with a square hole) andWoodBlock17(a wooden circle with three round cut-outs). The hole is real: the physics body is made of the convex pieces that are left (polydecomp::CutHolesinsrc/physics/polygon_decompose.h: the outline and each hole are split into convex pieces, the hole is subtracted piece by piece and neighbouring pieces are joined again), so the mass is lower, a ball goes through, and the block collides along the edge of the hole. The outline can be a box, a circle (a 32-sided polygon) or any polygon, concave too, and a hole can be a box (with an angle), a circle or a polygon, fully inside, in the middle, across an edge or a corner (the top-left corner of a box, say), outside (it does nothing) or overlapping another hole.createShapeWithHoles(name, sprite, x, y, outline, holes, density, friction, restitution, collision, controllable, zOrder)makes one from a script (shapes in world units about the body's origin);registerHoles(sprite, holes [, vertices])gives every block that starts with that sprite its holes (shapes from 0 to 1 over the block), so a level file orcreateObjectmakes it withcreateBox,createCircleorcreatePolygonas before.createPolygonSpritetakes the holes as a seventh argument and leaves them clear in the sprite, with the darkened edge along the hole as well. A block with holes counts the contacts of its pieces with another body as one hit.docs/SCRIPTING.mdhas the shape format;extras/extra_scripts.lua(section 5,shapeBlocks) takesholesin an entry; physics tests for masses, hole positions and the ball passing through are intests/physics_world_test.cpp.