[Suggestion]box2d vertex limit - Solution Idea!

0 favourites
  • 6 posts
  • When I face the box2d vertex limit problem, resolved in some way in r198, and looking to the problem I found some solutions at least for other engines. One of the solution was to implement polygon decomposition, It could be a good idea implement this on the editor. It works creating a Body with several Fixtures. Those fixtures will have max 8 vertices and will share some of the vertices, so ill will simulate a bigger piece using smaller parts, which are stuck together.

    In the editor maybe It can be implemented in a way to auto decompose the main polygon into pieces. Or maybe after adding more than 8 vertices it will auto decompose to the next polygon.

    This way we don't decrease performance or project size importing multiple images.

    The Actual Output of the Construct2 polygon system as I saw in the project file is:

    <collision-poly>

    <point x="0.163934" y="0.191257" />

    <point x="0.315574" y="0.0846994" />

    <point x="0.5" y="0.0437158" />

    <point x="0.673497" y="0.0812841" />

    <point x="0.822404" y="0.17623" />

    <point x="0.916667" y="0.326503" />

    <point x="0.956284" y="0.504098" />

    <point x="0.910519" y="0.681011" />

    <point x="0.818306" y="0.822404" />

    <point x="0.678962" y="0.919399" />

    <point x="0.528689" y="0.948941" />

    <point x="0.529201" y="0.58312" />

    <point x="0.469603" y="0.584785" />

    </collision-poly>

    so maybe we could ending having something like:

    <collision-poly>

    <vertices set="0">

    <point x="0.163934" y="0.191257" />

    <point x="0.315574" y="0.0846994" />

    <point x="0.5" y="0.0437158" />

    <point x="0.673497" y="0.0812841" />

    <point x="0.822404" y="0.17623" />

    <point x="0.916667" y="0.326503" />

    <point x="0.956284" y="0.504098" />

    <point x="0.910519" y="0.681011" />

    <vertices>

    <vertices set="1">

    <point x="0.818306" y="0.822404" />

    <point x="0.678962" y="0.919399" />

    <point x="0.528689" y="0.948941" />

    <point x="0.529201" y="0.58312" />

    <point x="0.469603" y="0.584785" />

    <vertices>

    </collision-poly>

    note: this post was posted by error on the closed bugs section, I delete it from there and re post it here!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I do not actually remember that error existing in the web variant of box2d, only in the asm.js one, it might be better to actually look into why there is one in the first place.

  • It's an inconsistent problem (with asm.js), which is irritating... Just for the fun of it, here's an example that has an object with 33 vertices - no probs!

  • Colludium

    That polygon is concave. The physics behavior breaks concave polygons into multiple convex ones internally. The reason it works is none of those convex polygons likely have more than 8 points, or 16 starting with release 198. The limit is likely an optimization, but instead of giving an error it would be nice if convex polygons with more than 8 points were just split into multiple to allow users to not worry about it.

  • Thanks for the clarification, There I go again - displaying my limited understanding in how the engine works....!

  • Great clarification indeed!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)