tags:

views:

893

answers:

1

I have 2 slight problems : chipmunk collision detection : i'm developping a game where i detect collisions between a ball and some static polygon shapes. this is working but "partially", meaning that it works for around 5 game scenes (level 1 - 5 , for ex.) but fails for the 6th one, and then on the 7th scene everything works ok etc.. basically, the collision detection is working but fails at times..

I don't think its a problem with setting spaces, bodies etc.. because everything works ok for a while and the error only occurs once after a series of "correct scenes". At 1st i thought the problem was my not removing shapes and bodies from the space after a scene is over, but the problem still continues after removed the bodies and shapes from the space.

cocos2d : as for cocos2d, i have the impression that the accelerometer activation fails at times.

has anyone come across any of these problems? any suggestions are welcome, thanks.

Posts: 1 Joined: Wed Jun 24, 2009 2:34 pm

A: 

Are you only using chipmunk for collision detection?

If so, don't. Just define the collision between the two shapes (assuming the polygons are similar). Here is an example for two circles: http://kwigbo.com/wp/2009/03/04/cocos2d-circle-to-circle-collision-detection/

In my own game I defined a collision between two rectangular sprites by checking through the array objects and seeing if they were withing a certain range on either side of my hero, and also a certain distance with the top or bottom. Doing this for a funky shape would be tricky, but worth it.

deeb