Swift 如何缩放SCNNodes以适应盒子?

Swift 如何缩放SCNNodes以适应盒子?,swift,scenekit,Swift,Scenekit,我有多个collada文件,其中包含各种大小的对象(人),这些对象是从不同的3D程序源创建的。我希望缩放对象,使其适合框架或框内。根据我的阅读,我无法使用边界框来缩放节点,那么您利用什么功能来缩放节点(相对于彼此) // humanNode = {...get node, which is some unknown size } let (minBound, maxBound) = humanNode.boundingBox let blockNode = SCNNode(geometry:

我有多个collada文件,其中包含各种大小的对象(人),这些对象是从不同的3D程序源创建的。我希望缩放对象,使其适合框架或框内。根据我的阅读,我无法使用边界框来缩放节点,那么您利用什么功能来缩放节点(相对于彼此)

// humanNode = {...get node, which is some unknown size }

let (minBound, maxBound) = humanNode.boundingBox

let blockNode = SCNNode(geometry: SCNBox(width: 10, height: 10, length: 10, chamferRadius: 0))

// calculate scale factor so it fits inside of box without having known its size before hand.

s = { ...some method to calculate the scale to fit the humanNode into the box }

humanNode.scale = SCNVector3Make(s, s, s)
如何得到它相对于我想要放入的文本框的大小并缩放它? 是否可以将节点从屏幕上画出以测量其大小