marionthefourth
marionthefourth

Reputation: 47

How to Add SCNView on top of a SKView

I am trying to add a SCNView on top of a SKView.

My hierarchy begins with a UIViewController. From there I present a SKScene on top of the UIViewController's view. Then I had added a few layers of SKSpriteNodes.

Visually speaking, I want to add a SCNView on top of the top layer of SKSpriteNodes for me to display a row of SCNBoxes.

Is there any way for me to do this aside from creating another UIViewController, adding all of my components on top of that new controller, then adding it on top of my currently existing ViewController?

I would appreciate a solution in Swift code, but I am able to read/write Objective-C, I just don't want to mix any Swift with Objective-C as I haven't needed to use any for my current project.

Upvotes: 2

Views: 722

Answers (1)

rickster
rickster

Reputation: 126127

If you want to render 3D SceneKit content in a SpriteKit view, use SK3DNode. Then you get both the SK and SCN renderers cooperating to draw into the same OpenGL context (or Metal drawable), instead of trying to composite the output of two separate rendering pipelines at the UIKit level.

Upvotes: 3

Related Questions