Closed Whyisthisnotavalable closed 1 year ago
2-D physics engines only support convex shapes. So in matter.js you would need to 2+ shapes to make a cave.
Then whats decomp in the library folder used for?
google bard says:
The poly-decomp library module for Matter.js enables concave vertex decomposition support when using Bodies.fromVertices. The poly-decomp library decomposes 2D polygons into convex pieces in JavaScript. You can install the poly-decomp library and use Common. You can also try drawing a polygon using the poly-decomp.js Github repo. There's also an online poly-decomp playground where you can view and fork poly-decomp examples.
so it looks like it's used to turn concave into convex. But you can also just do it manually, which is what I do. I'm not sure how to get the auto decomp to work so let me know if you figure it out.
The hitbox works, it's just that it acts as if decomp was not there.
What I mean is, the decomp did work, you just didn't render things correctly.
spawn.mapVertex(0, 10000, "0 0 10000 10000 20000 0 15000 -20000 10000 -10000 5000 -20000") This does not work