Is it possible to translate from a SCNView to a UIView? I have a login button from an overlay on my SCNView but I want the login button to take the user to a UIView to login.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
May not be the most elegant way to do it but something like this might work for you.....
- (void) handleTap:(UITapGestureRecognizer*)gestureRecognizer {
// get tap location
CGPoint p = [gestureRecognizer locationInView:scnView];
// convert to sk scene coordinates
CGPoint p2D = [scnView.overlaySKScene convertPointFromView:p];
//test if we hit the login button
SKNode *loginButton = [scnView.overlaySKScene nodeAtPoint:p2D];
// assuming your loginButton is of type SKLabelNode
if (loginButton != nil && ( [loginButton isMemberOfClass:[SKLabelNode class]] )) // add other tests here
{
// Here you can add code to transition to another
// view controller to handle logins
} else {
// do hit test on scnView here for the 3D scene
// .........
}
}