如何缩放SCNNode使其适合盒子?

时间:2019-03-04 23:19:17

标签: swift scenekit

我有多个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)

如何获得相对于要放入并缩放的文字框的大小? 是否可以在屏幕上绘制节点以测量其大小?

0 个答案:

没有答案