Touches Crashes
Posted: Thu Dec 01, 2011 4:34 pm
I used the following code to register touches for my Chimpmunk bodies. I find that if I drag a finger from off the iPad screen onto the iPad screen the app crashes. At first I thought it was reacting (crashing) to having two fingers on the screen - but I have isolated it to having one finger being dragged from off the screen - back on the screen - very strange. I used this code based on the awesome RW tutorial.
This is the error message
Aborting due to Chipmunk error: Unsolvable constraint.
Failed condition: determinant != 0.0
Source:CatNap/libs/Chipmunk/include/chipmunk/constraints/util.h:123
(gdb)
- Inside the init method
This is the error message
Aborting due to Chipmunk error: Unsolvable constraint.
Failed condition: determinant != 0.0
Source:CatNap/libs/Chipmunk/include/chipmunk/constraints/util.h:123
(gdb)
- Inside the init method
Code: Select all
mouse = cpMouseNew(space);
self.isTouchEnabled = YES;
Code: Select all
- (void)registerWithTouchDispatcher {
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
cpMouseGrab(mouse, touchLocation, false);
return YES;
}
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
cpMouseMove(mouse, touchLocation);
}
- (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event {
cpMouseRelease(mouse);
}
- (void)ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event {
cpMouseRelease(mouse);
}