0

I'm adding a simple emitter node this way:

enter image description here

class ViewController: UIViewController {

    override func viewWillAppear(_ animated: Bool) {
        self.addParticles()
    }

    func addParticles() {
        if let emitterNode = SKEmitterNode(fileNamed: "particles.sks") {
            let skView = SKView(frame: UIScreen.main.bounds)
            skView.backgroundColor = .clear
            let scene = SKScene(size: UIScreen.main.bounds.size)
            scene.backgroundColor = .clear
            skView.presentScene(scene)
            skView.isUserInteractionEnabled = false
            scene.anchorPoint = CGPoint(x: 0.5, y: 0.5)
            scene.addChild(emitterNode)
            emitterNode.position.y = scene.frame.maxY
            emitterNode.particlePositionRange.dx = scene.frame.width
            self.view.addSubview(skView)
        }
    }

}

I want the particles to fill the whole screen, and to do so I'm using UIScreen.main.bounds as the particles size. But by doing this, here is the result that I'm getting :

enter image description here

So for some reason, the particles only fills the top half of the screen, and I don't understand why. Could you help me understanding this?

Thank you very much

Another Dude
  • 1,204
  • 4
  • 15
  • 33

0 Answers0