tonywang
tonywang

Reputation: 191

How to access scenekit built-in geometry types after node creation?

Let's suppose I have created a SCNBox. Then I have added it to the sceneView. SceneView is an instance of ARSCNView.

let box = SCNBox(width:0.3, height:0.3, length:0.3, chamferRadius: 0)
let boxNode = SCNNode(geometry: box)
sceneView.scene.rootnode.addChildNode(boxNode)

How do I access the property of SCNBox after it is converted to a node? I want to access the width, height and length property so I can "resize" the box. I know there are transformations that apply to the node, but I do not know how big or small the box will be unless it is in real time. Is this still possible?

Upvotes: 1

Views: 79

Answers (1)

Andy Jazz
Andy Jazz

Reputation: 58063

Try this approach:

boxNode.geometry = SCNBox(width: 0.01, 
                         height: 0.05, 
                         length: 0.01, 
                  chamferRadius: 0)

Upvotes: 1

Related Questions