Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 :/

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Yep, that worked, inverting the vertexes was the key to the problem thanks for the answer :) –  Rudy_TM Mar 6 '12 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.