0

I am trying to get the vertices for an image I have in my app. Currently I have been using Vertex Helper but I want to make my vertex shape a bit wider. However, I am not sure how do this with hard coded values.

I have tried to use Physics Editor but it just outputs a plist which I don't think I can use with the iOS Cocos2D. Anyway what program can I use to get the exact shape I'm looking for and getting the values for that shape for Box2D?

Also just to provide a little more context this is an example of the initialization of a vertex shape that I am talking about:

b2Vec2 verts[] = {
            b2Vec2(-25.6f / PTM_RATIO, 50.7f / PTM_RATIO),
            b2Vec2(-20.6f / PTM_RATIO, -48.0f / PTM_RATIO),
            b2Vec2(27.3f / PTM_RATIO, -48.0f / PTM_RATIO),
            b2Vec2(21.5f / PTM_RATIO, 51.5f / PTM_RATIO),
            b2Vec2(-26.8f / PTM_RATIO, 49.8f / PTM_RATIO) };
        spriteShape.Set(verts, num);

Any advice, tips, or ideas would be highly appreciated!

SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
  • Consult the PhysicsEditor documentation. Of course you can use it with cocos2d-iphone. You need to use the GBShapeCache class provided in the PE installer DMG. Once you get past that, you'll ask yourself how you could have ever worked with VertexHelper. ;) – CodeSmile Aug 19 '12 at 14:25
  • That's great to hear! One question though, Since I scale my image to be either bigger or smaller, is it possible to also scale the shape from the plist to match the size of the image? – SimplyKiwi Aug 19 '12 at 15:53

1 Answers1

0

I decided to go ahead and use PhysicsEditor with the GB2ShapeCache files. I am going to have to do some subclassing and modification though of the class because it is not natively made to work with b2ContactListeners I guess. Anyway can correct me if I am wrong though.

SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191