Sceneview Camera Node全屏

时间:2017-11-12 01:33:27

标签: ios objective-c xcode artoolkit

我正在尝试将camera node的大小设置为与scene view相同。我已设法将scene view设置为适合整个屏幕,这已通过设置此背景颜色来证明。这是通过以下代码实现的:

CGRect aFrame = self.sceneView.frame;
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;

aFrame.size.width =  screenWidth;
aFrame.size.height = screenHeight;

self.sceneView.frame = aFrame;

然而,当我初始化我的相机节点时,它似乎没有填满场景视图,我不知道如何访问和设置其大小,以便相机填满整个屏幕。我对objective-c相当新,所以对所有的帮助表示赞赏。

摄像机节点的代码可以在下面找到:

 - (nonnull SCNScene *)createScene {
  SCNScene *scene = [SCNScene scene];
  SCNNode *cameraNode = [SCNNode node];
  cameraNode.camera = [SCNCamera camera];
  cameraNode.position = SCNVector3Make(0, 0, 10);
  [scene.rootNode addChildNode:cameraNode];
  _cameraNode = cameraNode;

  _trackableNodes = [NSMutableArray new];
  return scene;
}

0 个答案:

没有答案