开发者

Chipmunk collision detection

开发者 https://www.devze.com 2022-12-15 23:12 出处:网络
I am completely new to chipmunk and I have just been using it for a few days, so I\'m guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback

I am completely new to chipmunk and I have just been using it for a few days, so I'm guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback or method in 开发者_如何学编程chipmunk that tells you that 2 given shapes have collided?.

If not is the best way to simply use cgrectcontains on the sprites?.

-Oscar


You can get to it from Ipthnc's link, but this is the documentation you're probably looking for - it details the collision callback system:

http://chipmunk-physics.net/release/ChipmunkLatest-Docs/#CollisionCallbacks


Does this help:

http://code.google.com/p/chipmunk-physics/wiki/CollisionDetection

// Reference line
// Does not collide with other objects, we just want to draw it.
shape = cpSegmentShapeNew(staticBody, cpv(-320,0), cpv(320,0), 0.0f);
shape->collision_type = 1;
cpSpaceAddStaticShape(space, shape);
// Add a collision pair function to filter collisions
cpSpaceAddCollisionPairFunc(space, 0, 1, NULL, NULL);

Finally, use Google Code Search:

http://www.google.com/codesearch?q=lang:c+chipmunk+collision&hl=en&btnG=Search+Code

0

精彩评论

暂无评论...
验证码 换一张
取 消