In cocos2d, i've got two objects that I want to detect collision with. Im using CGrectintersectsrect, which has been working fine thus far. But I want to divide up the bounding box of one of my objects into 4 quarters, so th开发者_如何学Goat if my object collides in any one of these quarters, appropriate physics can then be applied.
At the moment, there is only 1 large boundingBox which is insufficient. Ideally I would want 4+...
Is this possible, and if so how could i achieve this? If not, is there any other avenue that could work? Thanks everyone, once again :)
The boundingbox method returns a CGRect. You have to divide your rect manualy, there is no pre-made method for that. Otherwise if there is a lot of objects, the best way to detect the collisions is to use Box2d. You can follow this tuto to see How To Use Box2D For Just Collision Detection with Cocos2D iPhone tutorial.
精彩评论