iosswiftsprite-kitscenekit

Should I use `overlaySKScene` or `SK3DNode` when mixing SceneKit and SpriteKit?


I am making a 3D game but would like to reuse some of the components in my existing 2D games (e.g. the pop-up paused window). The top and bottom region where I display menu items are also be 2D. The main canvas is in the center.

There seems to be 2 approaches:

  1. Use SCNView with SCNScene, and set its overlaySKScene for the 2D UI
  2. Use SKView with SKScene, and add a SK3DNode that contains the SCNScene.

The first one is basically putting SpriteKit in SceneKit, and 2nd approach is the opposite. I am wondering which one is the right approach? What's the pros and cons?


Solution

  • I initially went with SK3DNode approach, but encountered 2 limitations:

    How to set SCNTechnique for SK3DNode

    SK3DNode's hitTest function not finding the right SCNNode

    I am not sure if there's a solution to each of them (there could be none). So I had to switch to using SCNView.