【发布时间】:2019-08-03 09:10:50
【问题描述】:
您好,我有一个包含 3 个节点的非常简单的场景:
- 光
- 相机
- Stl
放置 STL 时,它非常小,因此用户必须大幅缩放相机。我想做的是以编程方式将相机缩放到适合的 STL 节点,但我不确定如何。
这是我目前所拥有的:
stlNode = .... // Custom node
lightNode = scene?.rootNode.childNode(withName: "omni", recursively: true)
cameraNode = scene?.rootNode.childNode(withName: "camera", recursively: true)
cameraNode.constraints = [SCNLookAtConstraint(target: stlNode)]
// Zoom to fit the stlNode here.
scene?.rootNode.addChildNode(stlNode)
【问题讨论】: