상자 위에 구를 넣으려고하는데 위치가 이상합니다. 상자 안에 공이 절반 숨겨져 있습니다. 상자를 바꾸고 피벗 피벗을 시도했지만 도움이되지 않았습니다.SceneKit - 다른 SCNNode에 SCNNode 추가하기
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)`
여기 코드는? 상자의 윗면에 공을 올려 놓는 법?
UPDATE : 내가 대신 볼의 큐브를 추가하면 내가
그래, 아니에요!하지만 난이 전체 반경을 추가해야하는 이유 (1) 대신 0.5? 나는 앵커 생각 구의 점이 중간에 있습니까? –
@TimurMustafaev 왜 r과 r/2가 아닌지에 대한 대답이 업데이트되었습니다. –