Closed a6965921 closed 2 years ago
That is by design, Box2D doesn't support that for you. You have to decompose the concave polygon into convex ones yourself.
I'm not an expert, but a Google search reveals the following:
See https://github.com/erincatto/Box2D/issues/513
See also https://stackoverflow.com/questions/41515307/box2d-why-not-concave-shapes
See also http://masc.cs.gmu.edu/wiki/Box2d
Or search on NPM for convex decomposition
Looking forward to your writing a demo
@Ziriax has helped sufficiently already.
box2d-wasm is a bindings library, with no goal of adding functionality to Box2D (which is in any case closed to contributions).
Convex shapes are not supported
const square = new b2PolygonShape(); var vArray = [new b2Vec2(0,-20),new b2Vec2(25,0),new b2Vec2(15,30),new b2Vec2(-15,30),new b2Vec2(-25,0)] square.Set(vArray, 4);