0

I have created a single body in box2D, which consists of 2 fixtures. I have a CCSprite userData for each fixture, but i don't know how to set the sprite position and rotation to match the fixture shape...i can't find shape.position or fixture.position in the docs.

What i'm missing ?

Thanks!

Fernando
  • 7,785
  • 6
  • 49
  • 81

1 Answers1

0

I am not an expert at cocos2d and box2d myself and I am just learning both at the moment, but is there any reason why you can't just create a separate body for each fixture and then fix them together with a joint of some sort then assign the CCSprite userdata to each body?

jin
  • 735
  • 3
  • 10
  • Yes, actually you're right, since the fixtures may need to move/rotate relative to each other, which is impossible if you use only one body, because its a rigid body simulation. I was trying to avoid joints, but now i'm convinced it's the only way. Thanks. – Fernando Sep 12 '11 at 21:49
  • No problem. Joints arent too hard once you've made a few. I found this post useful, even though its not directly iOS related. http://blog.allanbishop.com/box2d-2-1a-tutorial-part-2-joints/ – jin Sep 12 '11 at 22:17