Open jhudziak opened 8 years ago
Maybe you not need to fix hitTest method for landscape orientation. This sample work in landscape orientation, by prepare like below:
vuforiaManager?.prepare(with: .landscapeLeft)
I wrote this functionality. If you want i can fork this project with rotation support, and later you can add this to your sample.
But my question is about touchedNodWithLocationInView. Did i change it propperly?
- (SCNNode*)touchedNodeWithLocationInView:(CGPoint)location {
CGPoint pos = location;
pos.x *= [[UIScreen mainScreen] nativeScale];
pos.y *= [[UIScreen mainScreen] nativeScale];
pos.y = _manager.viewport.size.height + _manager.viewport.origin.y - pos.y;
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeLeft){
pos.x += fabs( _manager.viewport.origin.x);
}
NSArray* results = [_renderer hitTest:pos options:nil];
return [[results firstObject] node];
}
But my question is about touchedNodWithLocationInView. Did i change it properly?
If you want to use in landscape mode only,
I think you don't need to modify touchedNodeWithLocationInView
method.
You can you use in landscape mode to setup like below:
swift vuforiaManager?.prepare(with: .landscapeLeft)
Otherwise, you might need to modify it.
Do you know how to calculate position x and y used in hitTest method when vuforia and device work in landscape orientation ?
Regards, JH