# Why set the position of both b2Body and Box2DSprite?

In a game, we add a body for each sprite, the method is:

createBodyAtLocation:(CGPoint) forSprite:(Box2DSprite*)sprite


In which we create the body and we attach it to the sprite in parameter: sprite.body = body;

Then we set the position of the body, but later on in the code, in the update method, we also set the position of the sprite to the same position as the body. I was wondering: Why are we doing it twice? As we already set the position of the body in the world, and we made a link between the two with sprite.body?

• You're asking people why you're doing this in your code? I'm confused. – MichaelHouse Apr 24 '12 at 16:47
• @Byte56 : yes because it's not my own code, i'm reading a book and i'm not sure to understand why we do this? i think it's a general rule in box 2d, isn't it? – Paul Apr 24 '12 at 16:53
• @Byte56 : thanks, ok i thought the sprite was the container of the body. can you post an official answer? – Paul Apr 24 '12 at 17:51