5.9 C
New York
Thursday, November 14, 2024

ios – SK3DNode taking on the entire display screen regardless of the body


I’ve the next minimal reproducible code:

class GameViewController: UIViewController {
  
  override func viewDidLoad() {
    tremendous.viewDidLoad()
    
    if let view = self.view as! SKView? {
      
      let scene = SKScene()
      let node3D = SK3DNode(viewportSize: CGSize(width: 200, top: 200))
      node3D.place = CGPoint(x: 100, y: 100)
      
      let scene3D = SCNScene()
      node3D.scnScene = scene3D
      scene.addChild(node3D)
      
      let digital camera = SCNCamera()
      let cameraNode = SCNNode()
      cameraNode.digital camera = digital camera
      cameraNode.place = SCNVector3(x: 0, y: 0, z: 10)
      scene3D.rootNode.addChildNode(cameraNode)
      
      
      let field = SCNBox(width: 1, top: 1, size: 1, chamferRadius: 0.1)
      field.firstMaterial?.diffuse.contents = UIColor.inexperienced
      scene3D.rootNode.addChildNode(SCNNode(geometry: field))
      scene3D.background.contents = UIColor.crimson
      
      
      
      
        
      view.presentScene(scene)
      
      view.ignoresSiblingOrder = true
      
      view.showsFPS = true
      view.showsNodeCount = true
    }
  }
}

Right here I merely put a SK3DNode at backside left nook. After I set breakpoint, I additionally see the body of the SK3DNode to be (0, 0, 200, 200), which is appropriate.

Nevertheless, after I see the node beneath view hierarchy, I discovered it taking on the entire display screen, which is sort of odd. See the pic under:

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles