b2polydef - a pretty easy question

heyoa

i have problems when creating a polydef. everything worked fine with triangles, but when i try to create a pretty easy object the program just exits when the b2body is being created...

this is the object (1 to 6 are the points i used in the code...)
Attachment:
File comment: the object
object.png
object.png [ 3.94 KiB | Viewed 404 times ]


this is the code
Code:
polyDef.vertexCount = 6;
      polyDef.vertices[0].Set(17.0f * scale, -22.0f * scale);
      polyDef.vertices[1].Set(17.0f * scale, 5.0f * scale);
       polyDef.vertices[2].Set(0.0f * scale, 5.0f * scale);
      polyDef.vertices[3].Set(0.0f * scale, 22.0f * scale);
      polyDef.vertices[4].Set(-18.0f * scale, 22.0f * scale);
      polyDef.vertices[5].Set(-18.0f * scale, 23.0f * scale);


any help would be greatly appreciated! 🙂
okay... problem solved... the angle between 3 and 4 is bigger than 180°... whooops 😆

question: will there be support for more complex polys in v2.0?
Well you can already make more complex shapes with compound shapes, but according to the TODO.txt in the SVN meshes are planned for v2.1.
have a point 7 between 5 and 6, then create two shapes

one as points 6, 1, 2 and 7
second as points 7, 3, 4 and 5

Attach them to the same body and off you go.

(it had me confused initially, then I realized that this sort of shape is actually convex! doh!)
Hierro wrote:
question: will there be support for more complex polys in v2.0?


convex shape decomposition: viewtopic.php?f=4&t=83

Original thread: https://box2d.org/forum/viewtopic.php?t=313