I'm new to SceneKit
and 3D objects. I've been doing some research but I didn't find an answer to my question.
I need to display several 3D objects in an horizontal UICollectionView
, one in each cell. I'd like them to be aligned and the same size so I'd like them to fit the parent view, aka the SCNView
.
An image to picture the scenario:
I'd like that the bounds of the 3D object visually matches the bounds of the SCNView. I want the 3D object to "fit" in the view, a bit like UIViewContentMode.scaleAspectFit
.
Here's my code so far:
let scene=SCNScene(named: file_name)
let node=scene.rootNode.childNode(withName: node_name, recursively: true)!
node.scale=SCNVector3Make(28, 28, 28)
node.position=SCNVector3Make(0, 0.05, -0.5)
scene.rootNode.addChildNode(node)
sceneview.scene=scene