Spritekit as material of SCNnode.. crash.. bad

What I'm try to do, is replicate some digital instrument gauge ...using Spritekit..

On my project I have to use a SpriteKit Scene as material for Scenekit SCNnode.

In order to do that I create a sub class of SKscene and and apply it as "material.diffuse.contents" of the SCNNode.

all working fine, I can see my SKscene as material of the SCNNode.

Here the issue:

I try to animate/replicate the correct indication of the instrument based of some value my app received from other source.

To do so, i decide to use the SKsceneDelegate and use the method "update(_ currentTime: TimeInterval)"

simply the update method look for the sknode of the green needle "fulcro" remove it , and make a new line calculating the angle and new coordinate for the new line.

Like this I should have a smooth needle indication...

Here is the update method inside my subclass SKscene:


override func update(_ currentTime: TimeInterval) {

        

        guard let fulcroToRemove = self.childNode(withName: "fulcro") else {return}

        fulcroToRemove.removeFromParent() // issue here... 



        let fulcro = SKNode()

        fulcro.name = "fulcro"

        fulcro.position = CGPoint(x: 300, y: 260)

        let line = makeLine(startPos: CGPoint(x: 0, y: 0),

                            endPos: getCoordinate(angleDeg: getCurrentEGT()),

                            name: "EGT_LINE")

        fulcro.addChild(line)

        self.addChild(fulcro)

    }





here how I apply the material SKscene to my SCNnode


class LowerECAM : SCNNode {
    var systems: PlaneSystems

    init(systems: PlaneSystems) {
    self.systems = systems
        super.init()
        createLowerECAM()
    }
    required init?(coder: NSCoder) {

        fatalError("init(coder:) has not been implemented for Make Cockpit")

    }
    func createLowerECAM(){
systems.lowerECAMView.presentScene(systems.newAPU)

        let plane = SCNPlane(width: 1, height: 1)

        let material = SCNMaterial()

        material.isDoubleSided  = true

        material.diffuse.contents = systems.lowerECAMView.scene // apply here
 plane.materials = [material]
        let lowerECAM = SCNNode(geometry: plane)
        lowerECAM.eulerAngles = SCNVector3(deg2rad(180), deg2rad(90), 0)

        lowerECAM.scale = SCNVector3(3.3, 3.3, 3.3)
        self.name = "LowerECAM"
        self.addChildNode(lowerECAM)
    }

    func deg2rad(_ number: Double) -> Double {
        return number * .pi / 180
    }

  func rad2deg(_ number: Double) -> Double {
        return number * 180 / .pi
    }
}

But.. I'm getting the following crash:

Question?? why scene kit crash when the render I'm using is the Spritekit render.. ?? I did't even write the SceneKit render method..

The issue looks like is when I remove the "fulcro" but I can't find the solution.

I tried to make a new project only with spritekit and it works perfect.. can't understand why as material of SCNode it crash.

Any Suggestion.. Appreciate..

Thanks a lot

Spritekit as material of SCNnode.. crash.. bad
 
 
Q