Assertion when creating a shape

Hi,

I'm currently adapting our code to work with 2.0.0, used 1.4.3 before.

I get an assertion on line 224 in b2polygonshape.cpp when creating a b2PolygonShape.
I want it to be a box with certain extents, so I use the SetAsBox method, which seems closest to the behavior of the old b2BoxDef struct. I set the extents to 0.03m and 0.06m just as before and nothing has changed in the definition except for its typename (and that it now gets sent to World::Create).

I see this assertion has something to do with calculating a "core polygon shape" by "shifting edges inward [based on their normal]. But I have no real idea of what the assertion means to me, or how I pass that test (I find the maths a bit hard to follow without comments on what variables are used for etc).


In an unrelated problem, I also have a hard time figuring out in which order I should put vertices for the PolygonShape. I know the documentation states CCW. But I had to define some polyshapes in CW or I got an assert. That was easy to work around though, since I was only making triangles and quads. I figured that it might be because we were using negative Y as up, just like a monitor. The documentation only states "Y is up", but from what I can tell that is equal to "Y is down", as it's just an axis and not real direction. 😉
You cannot have a shape with a radius less than b2_toiSlop, which I currently have set to 8*b2_linearSlop = 8 * 0.005 = 0.04m = 4cm. Try reducing b2_toiSlop to 5 * b2_linearSlop = 2.5cm. Thanks for pointing this out. I'll make sure it is easier to understand the restriction.

You must use a CCW ordering for a right-handed coordinate system with the z-axis coming out of the screen. You must map this convention onto whatever coordinate system you are using.
Ah that explains it very well, thank you. I'll increase the size of our smallest objects slightly instead since they are more of a visual addition and they don't interact much with other things in the world anyway.

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