How do I create a HUD on top of my Scenekit.scene

Ghis picture Ghis · Jun 25, 2014 · Viewed 9k times · Source

I'm experimenting with Swift and Scenekit. Building a Mac OS X app. It seems quite easy to get a 3d-scene working. But what is scene without some kind of 2D hi-score, radar display, speed indicator, etc? I would expect a SpriteKit-scene to seamlessly integrate into a SceneView but I don't find the documentation very clear about this..

The most obvious and only way I can think of is to position a SKView over a SceneView and render each separately. But is there a more elegant way?

Answer

Toyos picture Toyos · Jun 26, 2014

try

scnView.overlaySKScene = aSKScene;

(see SCNSceneRenderer.h) This is the recommended way. An alternative way is to make the SCNView layer backed and add child views or layers (but this is less efficient).