The Dominoes sample shows how to transform a touch on a 2D screen to a 3D plane which relates to an Image Target.
In order to re-use this technique, the key methods to investigate here are HandleTouches() which handles the touches and this uses the projectScreenPointToPlane() method in order to create an intersection line for the touch. The code also shows how to check this line against all the dominoes to see if it touches it.
In order to get touch events from the screen, your view/class must handle events / implement methods for the following:
touchesBegan, touchesMoved, touchesCancelled, touchesEnded
As you can see from EAGLView.mm in the dominoes sample:
// Pass touch events through to the Dominoes module - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint location = [touch locationInView:self]; dominoesTouchEvent(ACTION_DOWN, 0, location.x, location.y); } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint location = [touch locationInView:self]; dominoesTouchEvent(ACTION_CANCEL, 0, location.x, location.y); } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint location = [touch locationInView:self]; dominoesTouchEvent(ACTION_UP, 0, location.x, location.y); } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* touch = [touches anyObject]; CGPoint location = [touch locationInView:self]; dominoesTouchEvent(ACTION_MOVE, 0, location.x, location.y); }
One can see that these touches are passed through to the dominoesTouchEvent(), which records the touches for later validation by HandleTouches.