我有一个自定义dae文件,并且我希望将其缩小以适应某些区域,遗憾的是,我发现如果缩放因子低于.65,则由于某种原因不会渲染节点。我不确定我做错了什么。这是我目前使用的代码。
func logoPanel(height: CGFloat, width: CGFloat) -> SCNNode {
let nodeCollection = SCNNode()
var v1 = SCNVector3(x:0, y:0, z:0)
var v2 = SCNVector3(x:0, y:0, z:0)
let logoNode = collada2SCNNode(Double(height))
let padding = 0.3
logoNode.getBoundingBoxMin(&v1, max:&v2)
if Double(v2.y - v1.y) + padding > (Double(height) - (radius*2)) / 2 {
// scale logo node down
let scaleFactor = Float(((Double(height) - (radius*2)) / 2) / (Double(v2.y - v1.y) + padding))
logoNode.transform = SCNMatrix4MakeScale(scaleFactor, scaleFactor, scaleFactor)
logoNode.position = SCNVector3Make(0, Float((-height/2.0) + 0.1), 0)
}
nodeCollection.addChildNode(logoNode)
return nodeCollection
}