I am rotating a 3d model with this code:
_mesh = [[NGLMesh alloc] initWithFile:@"01.obj" settings:settings delegate:self];
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[super touchesMoved:touches withEvent:event];
UITouch *touch;
CGPoint pointA,pointB;
if ([touches count]== 1) {
touch = [[touches allObjects]objectAtIndex:0];
pointA = [touch locationInView:self.view];
pointB = [touch previousLocationInView:self.view];
// _mesh.rotateY -= (pointA.x - pointB.x) * 0.5f;
// _mesh.rotateX -= (pointA.y - pointB.y) * 0.5f;
_mesh.rotateY += (pointA.x - pointB.x) * 0.5f;
_mesh.rotateX += (pointA.y - pointB.y) * 0.5f;
}
}
The code rotates like it's supposed to, but it rotates no matter where in the view I tap. I'd like it to only rotate while touching inside the imported model. How would I do this?