A few things:
- Enable Guard malloc simply wouldn't 'engage' and wouldn't work. No idea why as I also have no idea what that is...
- The issue with the custom updatePosition function seemed to go away, leaving only the issue of a crash on that mouseJoint stuff. Looks like the bug you fixed was saving me before.
So, I changed my code to:
Code: Select all
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
if(mouseJoint){
//[space remove:mouseJoint]; // HOW IT WAS. Line below was crashing because mouseJoint wasn't retained anywhere. (I think)
if ([mouseJoint.bodyB.data isKindOfClass:[FakeFingerSimple class]]) {
[self disableFakeFinger];
}
[space remove:mouseJoint]; // doing this fixed it.
mouseJoint = nil; // TODO - before assigning to nil, might have to manage memory here differently.
}
}
Regarding mouseJoints, I initialize him like this, assuming the touch touched the shape you wanna grab (is that correct?)
Code: Select all
mouseJoint = [space add:[ChipmunkPivotJoint pivotJointWithBodyA:mouseBody bodyB:body anchr1:cpvzero anchr2:cpvzero]];
I'm not retaining him anywhere, so as soon as I remove him from the space he gets released, correct? That would make my code there ok, right?
2 MORE THINGS:
The game is just unstable now. I often can't get my game started because upon entering the scene, the debugger stops everything and reports:
Code: Select all
Previous frame inner to this frame (gdb could not unwind past this frame)
If you could help me de-mystify what that actually implies, i'd be grateful.
Before that started happening, a collision separate callback was not firing which is critical to the gameplay. I'm still looking into this but the above issue is stopping me on that front.
I'm getting a little nervous that my game has just become totally unstable, and its errors of this nature that just have me feeling I'm WAY over my head.