如何在Scenekit.scene顶部创建HUD [英] How do I create a HUD on top of my Scenekit.scene

查看:126
本文介绍了如何在Scenekit.scene顶部创建HUD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试Swift和Scenekit. 构建一个Mac OS X应用程序. 获得3d场景似乎很容易. 但是,没有某种2D高分,雷达显示,速度指示器等的场景是什么? 我希望SpriteKit场景可以无缝集成到SceneView中,但是我发现文档对此并不十分清楚.

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..

我能想到的最明显也是唯一的方法是将SKView放置在SceneView上,然后分别渲染每个视图. 但是还有更优雅的方法吗?

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?

推荐答案

尝试

scnView.overlaySKScene = aSKScene;

scnView.overlaySKScene = aSKScene;

(请参阅SCNSceneRenderer.h) 这是推荐的方法.另一种方法是使SCNView图层受支持并添加子视图或图层(但这效率较低).

(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).

这篇关于如何在Scenekit.scene顶部创建HUD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆