I'm having trouble, like some other people seem to be having, in getting collision detection to work. The documentation is a little unclear and the examples don't seem to provide a clear JavaScript example. I'm not quite sure where to put my ChipmunkCollisionManager class.
I have only one object called crate that is duplicated many times. I'm trying to determine when two crates collide with each other.
1. I have named my prefab crate, "crate".
2. On the Chipmunk Box Shape, I have entered "crate" into the "Collision type" field.
3. On a script attached to each crate, I have this code:
Code: Select all
class collisionMananger extends ChipmunkCollisionManager {
function ChipmunkBegin_crate_crate(arbiter : ChipmunkArbiter){
print(arbiter);
return true;
}
}
Is this where the ChipmunkCollisionManager belongs? Does it belong on an object unrelated to the crates? Any idea what I'm doing wrong? Any help would be great.
Thanks
Ryan