Can I render the animation inside SCNView without adding it to the superview?

94 Views Asked by At

I have a task: to make a 3d object animated in SCNScene and do frame by frame scnView.snapshot() without adding SCNView to any subview. If I add SCNView to the subview - then everything works fine. But without adding it does not work. How can I start and manage this rendering?

I tried to scnView.sceneTime += 1 and call play() function - but no reaction. The same with isPlaying = true. Maybe the display calls some protocols for the scnView when display the scnView, but I can't find any of them to call this functions manually.

1

There are 1 best solutions below

1
On

There's some workaround that you can use to cheat your app. It's the layer's opacity. Even if the contents of the SCNView is invisible, you'll still be capable of taking snapshots.

self.view.addSubview(sceneView!)
sceneView?.layer?.opacity = 0.0