Forums » C++ Framework » Chipmunk collision callback not triggered »
| Fabien Roussot | Chipmunk collision callback not triggered | ||
|---|---|---|---|
|
Added by Fabien Roussot over 1 year ago
Hi everyone,
This is how I create my space and add my collision handler:
Here the declaration and definition of the spriteCollision function: @static int spriteCollision(cpArbiter *arb, cpSpace *space, void *data)
{ The initialisation occurs into the GameScene class, which is a subclass of CCScene, init function, I tried to make the spriteCollision function a static member of the class, pass it as "spriteCollision" instead of "&spriteCollision", both made no difference. Did anyone have the same problem ? Am I missing something? |
||
| Kevin H | RE: Chipmunk collision callback not triggered | ||
|
Added by Kevin H over 1 year ago
void cpSpaceAddCollisionHandler(
cpSpace *space,
cpCollisionType a, cpCollisionType b,
cpCollisionBeginFunc begin,
cpCollisionPreSolveFunc preSolve,
cpCollisionPostSolveFunc postSolve,
cpCollisionSeparateFunc separate,
void *data
);
typedef cpBool(*cpCollisionBeginFunc)(cpArbiter *arb, cpSpace *space, void *data);
The function prototypes look almost correct (int instead of cpBool?). Put a breakpoint in your game loop and double check that your bodies(and/or shapes) have the correct settings, cpCollisionType for instance. |
(1-1/1)