SceneKit: How to place a 3D object to fit the borders of SCNView?

I am new to SceneKit and 3D objects . I did some research, but I did not find the answer to my question.

I need to display several 3D objects in a horizontal UICollectionView , one in each cell. I would like them to be aligned and the same size, so I would like them to match the parent view, aka SCNView .

Image for script image:

3D objects, each in SCNView, same size

I would like the borders of the 3D object to visually match the borders of the SCNView. I want the 3D object to "match" in the view, a bit like UIViewContentMode.scaleAspectFit .


Here is my code:

 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 
+7
ios swift scenekit scnnode
source share

No one has answered this question yet.

See related questions:

1244
How to sort NSMutableArray with custom objects in it?
1180
How to check if a string contains another string in Objective-C?
928
How do I call Objective-C code from Swift?
one
iOS SceneKit for UIView Forecast
one
Create a large grid of similar objects with SceneKit
one
Change the "field of view" in SceneKit
0
It is possible for user interaction to display a node in SCNScene Swift
0
Resizing UICollectionView borders to fit cells using storyboard + auto layout
0
Get frame of SceneKit node in application window?
0
Adding multiple SCNViews at different depths with the same camera

All Articles