Is there a way to scale the bodies made from vertexes (like a guitar), i was trying to multiply each vertex point by the scale value but c++ mark an assertion failed, is there a mehtod to do this?

I have done it, but i want to make a mirror body, but i cant do it :/ just multplying it by -1 or 1 it doesnt run :/


1 Answer 1


Section 4.4 of Box2D manual says:

You must create polygons with a counter clockwise winding (CCW). We must be careful because the notion of CCW is with respect to a right-handed coordinate system with the z-axis pointing out of the plane. This might turn out to be clockwise on your screen, depending on your coordinate system conventions.

If you are taking a shape and mirroring the coordinates you are probably changing the winding and that is the reason it fails. But as you didn't provide an error log (the box2d c/c++ assertion) I can't be sure.

I believe you can perform the mirroring you want if you invert the array of vertices too, before creating the box2d shape. What I mean is, if you have [v1, v2, v3] then by inverting the array you will have [v3, v2, v1].

Hope it helps.

  • \$\begingroup\$ Yep, that worked, inverting the vertexes was the key to the problem thanks for the answer :) \$\endgroup\$
    – Rudy_TM
    Mar 6, 2012 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .