overlaySKScene未在ARSCNView上显示

时间:2017-07-21 17:38:46

标签: ios swift arkit

我正在使用ARKit制作游戏,我想要一个hud,所以我尝试了这个:

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

其中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")
    }   
}

我希望形状节点在屏幕中心生成。请有人帮帮我吗?

修改

我这样做了:

print(skScene)

我收到了skScene信息

但是当我这样做时:

print(self.sceneView.overlaySKScene)    

我发现没有,为什么?

0 个答案:

没有答案