我试图将球体放在盒子的顶部,但位置很奇怪:球半藏在盒子里。我试图改变盒子和球体枢轴,但没有帮助。这是代码:
let cubeGeometry = SCNBox(width: 10, height: 10, length: 10,
chamferRadius: 0)
let cubeNode = SCNNode(geometry: cubeGeometry)
//cubeNode.pivot = SCNMatrix4MakeTranslation(0, 1, 0)
scene.rootNode.addChildNode(cubeNode)
let ballGeometry = SCNSphere(radius: 1)
let ballNode = SCNNode(geometry: ballGeometry)
ballNode.pivot = SCNMatrix4MakeTranslation(0.5, 0, 0.5)
ballNode.position = SCNVector3Make(0, 5, 0)
cubeNode.addChildNode(ballNode)`
我做错了什么?如何将球放在盒子的顶部?
更新:如果我添加立方体而不是球,它看起来就像我想要的那样