How can you identify the sprite associated with a particular body while using box2D ? Sometimes you may need to identify the sprite associated with the body you are using. For that use the following line of code.

CCSprite *yourSprite= (CCSprite*)yourBody->GetUserData();

Now you got the corresponding sprite in your ‘yourSprite’



One Comment

  1. body June 22, 2011 at 3:19 am

    You’ve got great insights about body, keep up the good work!


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.