Reputation: 1823
Is there a way to add SKVideoNode to ARKit scene(Scenekit)? I tried adding SKVideoNode as SCNPlane geometry diffuse contents but it is not working,
let videoNode = SKVideoNode(fileNamed: "0.mov")
videoNode.size = CGSize(width: 200, height: 100)
videoNode.alpha = 0.8
videoNode.play()
self.videoNode = videoNode
let plane = SCNPlane(width: 0.05, height: 0.05)
let newMaterial = SCNMaterial()
newMaterial.isDoubleSided = true
newMaterial.diffuse.contents = self.videoNode
plane.materials = [newMaterial]
let node = SCNNode(geometry: plane)
parent.addChildNode(node)
Upvotes: 3
Views: 808
Reputation: 602
I had the exact same issue. Fixed by setting a size to my Sprite Kit Scene when I created it:
let spriteKitScene = SKScene(size: CGSize(width: 640, height: 480))
I hope that fixes your issue!
Upvotes: 2
Reputation: 126107
SKNode
is not one of the supported types for SceneKit material property contents. Neither are any of its subclasses.
If you want to get SpriteKit content mapped onto a SceneKit material, the way to do it is to set an SKScene
as the material property contents. That scene can then contain any number or type of SpriteKit nodes.
Upvotes: 4