Some time ago I wrote about the excellent Physics Editor tool, a highly polished editor allowing you to automatically trace objects and export the resulting vertex information for use in a number of game development frameworks such as Cocos2D-iPhone.
In order to use the vertex data for collision detection in Cocos2D you will need to set it up as a Chipmunk or Box2D application, set up your world, and collision bodies.
Today I came across a library that allows you to bypass all that – you no longer will need to set up your Cocos2D game as a Box2D game to get Box2D based collisions.
As stated in the readme for the library:
- Use PhysicsEditor to trace out the lowest resolution sprites used in your project. It’s important to use your low-res sprites to ensure PESprite works properly.
- Set each sprite’s anchor point in PhysicsEditor, which will be used automatically by PESprite. Ignore the other properties.
- Set PhysicsEditor’s Exporter to “Box2D generic (PLIST)” and export the plist file to your Resources folder.
- Then just write some code…
Examples are included.
A very handy bit of Cocos2D code.
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.