Help: Using Chipmunk with cocos2D on Xcode

Official forum for the Chipmunk2D Physics Library.
Post Reply
delcotron
Posts: 3
Joined: Fri Jan 13, 2012 4:50 pm
Contact:

Help: Using Chipmunk with cocos2D on Xcode

Post by delcotron »

Hi, I bought the indie version three days ago and I'm getting frustrated trying to use it on my projects. I am using Cocos2D on Xcode and I already have a working project which uses chipmunk. Now I intend to use Multigrab on my app but I'm stuck trying to understand what am I supposed to do with the files included on the indie download.

I've already tried removing the original Chipmunk files included with cocos2d and adding the new files instead but I get a bunch of errors, even after adding those files to the compile sources step. Also, I've been reading that I could add chipmunk as a static library, which it's supposed to be made by running a script called 'iphonestatic.command' but I can´t locate that file anywhere... and even if I had that library I don't know how am I supposed to use it.

Hope somebody can get me out of my ignorance :)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Help: Using Chipmunk with cocos2D on Xcode

Post by slembcke »

I'm guessing that the errors that you are getting are duplicate symbol errors because you are including both the original Chipmunk code that came with Cocos2D as well as the libObjectiveChipmunk.a static library. So you need to remove the old Chipmunk files (.c and .h) that came with Cocos2D and copy in the Objective-Chipmunk-iPhone/ directory. Make sure you tell Xcode to include them in the target.

The iphonestatic.command script that comes with Chipmunk's C code is to build a static library (the .a file). Chipmunk Indie only comes with the static library, so you don't need to worry about that.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
delcotron
Posts: 3
Joined: Fri Jan 13, 2012 4:50 pm
Contact:

Re: Help: Using Chipmunk with cocos2D on Xcode

Post by delcotron »

Thanks for the answer, I hadn't removed the old files, just added the new ones, tried again and had to remove the new files from the 'compile sources' phase (don't ask me why I had added them in the first place) and just had to remove the old and outdated resizehash callbacks. Didn´t have to add the new files in the target thou, everything went fine (apart from the outdated functions).

Just one more question, another callback I had to remove was the cpSpaceRehashShape, has it gone outdated too?

Thanks again!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Help: Using Chipmunk with cocos2D on Xcode

Post by slembcke »

It was renamed to cpSpaceReindexShape(). Chipmunk 6 supports more spatial indexes than just a spatial hash now.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
delcotron
Posts: 3
Joined: Fri Jan 13, 2012 4:50 pm
Contact:

Re: Help: Using Chipmunk with cocos2D on Xcode

Post by delcotron »

Ok, that's all (by now). Thanks a lot Scott!
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests