OverlaySKScene not showing in ARSCNView

I am using ARKit to create a game and I would like to have a hud, so I tried this:

let skScene = SightScene(size: self.view.bounds.size)
self.sceneView.overlaySKScene? = skScene
self.sceneView.overlaySKScene?.scaleMode = .aspectFill

      

Where sceneView:

var sceneView: ARSCNView!

      

SightScene:

class SightScene: SKScene {

    var circle: SKShapeNode!

    override init(size: CGSize) {
        super.init(size: size)

        circle = SKShapeNode(circleOfRadius: 40)
        circle.position = CGPoint(x: size.width/2, y: size.height/2 )
        circle.zPosition = 100
        circle.name = "Sight"
        circle.strokeColor = SKColor.black

        circle.glowWidth = 10.0
        circle.fillColor = SKColor.orange
        circle.physicsBody = SKPhysicsBody(circleOfRadius: 40)
        circle.physicsBody?.isDynamic = true

        self.addChild(circle)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }   
}

      

I wanted the node form to appear in the center of the screen. Please can anyone help me?

EDIT

I did this:

print(skScene)

      

I am getting information about skScene

but when i do this:

print(self.sceneView.overlaySKScene)    

      

I find zero, why?

+3


source to share





All Articles