Search code examples
cocos2d-iphonebox2dchipmunk

how to use xcode cocos2d project including both box2d and chipmunk?


I don't know if this sounds crazy. I have 2 xcode projects, 1 using cocos2d-box2d and the other using cocos2d-chipmunk, and want to merge them into one single project. I just know how to create project with choosing box2d/chipmunk, but not import one engine to an existing project with an engine. I tried to copy files to another project and errors showed at Box2d/chipmunk classes. How to import Box2D to a Chipmunk project (or the reserve) correctly?


Solution

  • Do not drop them both into your project. Create a static library target for each physics engine. That way you can make sure they build separately, and apply custom build settings for each where necessary.

    Since you're already in the process of converting a project you may find it easier to migrate to Kobold2D directly. Both Box2D and Chipmunk are setup and ready to use, there's nothing speaking against using both in the same project. All you'd need to do is add the headers for both physics engines and you're ready to go.

    PS: yes, it DOES sound crazy. :)