SceneKit 粒子系统未出现

SceneKit Particle System not appearing

我正在尝试使用 Scenekit 中的粒子系统向火箭添加火焰。粒子文件看起来很好,我没有收到任何错误,但是当我 运行 应用程序时,粒子没有出现。 reactor.scnp 和 spark.png 都在 art.scnassets 文件夹以及主应用程序文件夹中。

  @objc func sceneTapped(recognizer: UITapGestureRecognizer) {
        let location = recognizer.location(in: sceneView)

        let hitResults = sceneView.hitTest(location, options: nil)
        if hitResults.count > 0 {
            let result = hitResults[0] as! SCNHitTestResult
            let node = result.node

            let physicsBody = SCNPhysicsBody(type: .dynamic, shape: nil)
            rocket.physicsBody = physicsBody
            let direction = SCNVector3(0, 3, 0)


            let rocketshipNode = rocket

            let reactorParticleSystem = SCNParticleSystem(named: "reactor.scnp", inDirectory: nil) //SCNParticleSystem(coder: "art.scnassets/reactor")
            print(reactorParticleSystem)
                let engineNode = rocket.childNode(withName: "node2", recursively: false)
            print(engineNode)

            // 3
            physicsBody.isAffectedByGravity = false
            physicsBody.damping = 0

            // 4
            let collider = [floor]
            reactorParticleSystem?.colliderNodes = collider as? [SCNNode]
            // 5
            engineNode?.addParticleSystem(reactorParticleSystem!)

            // 6
            let action = SCNAction.moveBy(x: 0, y: 0.3, z: 0, duration: 3)
            action.timingMode = .easeInEaseOut
            rocketshipNode!.runAction(action)



        }
    }

不确定问题出在哪里,但我重新创建了粒子系统文件,它似乎工作正常。