I'm using ARKit with the ARFaceTrackingConfiguration
. It detects my face when I look at the camera, which is great. However, when I move out of view of the camera, I don't get renderer:didRemoveNode:forAnchor:
.
What I would like to do is detect when the face has gone so that I can reset the session and begin looking for a (potentially) new face.
Edit: Seems I can do something like this:
- (void)renderer:(id<SCNSceneRenderer>)renderer updateAtTime:(NSTimeInterval)time {
SCNVector3 location = [renderer projectPoint:self.faceNode.position];
CGPoint point = CGPointMake(round(location.x), round(location.y));
BOOL isNodeVisible = CGRectContainsPoint(self.view.frame, point);
// ... do stuff ...
}
Though I'm not sure that's the correct way to do it.