1

I am trying to use SKNode in overlaySKScene in a SCNView. But when I set the property isPlaying of the SCNView to true, my SKNodes are just going down.

This is my code in viewDidLoad:

sceneView.isPlaying = true;
sceneView.loops = true;
sceneView.scene = SCNScene()
sceneView.scene!.physicsWorld.gravity = SCNVector3(x: 0, y: 0, z: 0)
sceneView.overlaySKScene = SKScene(size: SceneView.frame.size)
sceneView.overlaySKScene?.scaleMode = .aspectFit
sceneView.overlaySKScene?.shouldEnableEffects = true
sceneView.overlaySKScene?.backgroundColor = SKColor.clear
sceneView.overlaySKScene?.blendMode = .alpha
let node = myFunctionToDrawCircle()
node.position = CGPoint(x: x, y: y)
sceneView.overlaySKScene?.addChild(node)

I linked the sceneView from a SCNView in the storyboard like others component.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
gfitas
  • 45
  • 7

0 Answers0